summaryrefslogtreecommitdiff
path: root/1430/CH9/EX9.9/exa9_9.sce
blob: 8c62d3e37e728a344a362026d1de545cb277eb80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//Example 9.9
// Natural response of a Phase-Shift Oscillator
// Continued from textbook example 9.7
C=2*10^-6;
R=100;
L=10*10^-3;
K=poly(0,'K'); // Variable gain K
alpha=(R/(2*L))*(L/(R^2*C)+1-K);
omega_0=sqrt(2/(L*C));
K=roots(alpha);
alpha=horner(alpha,K)
// Since this is the case of underdamped response
//Assume value for A_1 for illustration
A1=complex(0,1.974)
A1_m=abs(A1);
phase_A1=atan(imag(A1),real(A1));
t=0:0.01:1
t1=0:0.0001:0.02
v_out1=2*A1_m*cos(omega_0*t+phase_A1) // Underdamped response case1
K1=1; // New value of gain
alpha1=(R/(2*L))*(L/(R^2*C)+1-K1);
omega_d1=sqrt(omega_0^2-alpha1^2);
v_out2=2*A1_m*%e^(-alpha1*t1).*cos(omega_d1*t1+phase_A1);
K2=2;
alpha2=(R/(2*L))*(L/(R^2*C)+1-K2);
omega_d2=sqrt(omega_0^2-alpha2^2)
v_out3=2*A1_m*%e^(-alpha2*t1).*cos(omega_d2*t1+phase_A1)
subplot(3,1,1)
plot(t,v_out1)
xlabel('t')
ylabel('v_out1(t)')
title('Underdamped case 1')
subplot(3,1,2)
plot(t1,v_out2)
xlabel('t')
ylabel('v_out1(t)')
title('Underdamped case 2')
subplot(3,1,3)
plot(t1,v_out3)
xlabel('t')
ylabel('v_out1(t)')
title('Underdamped case 3')