diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /29/CH12 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '29/CH12')
55 files changed, 953 insertions, 0 deletions
diff --git a/29/CH12/EX12.1/exa12_1.sce b/29/CH12/EX12.1/exa12_1.sce new file mode 100755 index 000000000..93f4c7aae --- /dev/null +++ b/29/CH12/EX12.1/exa12_1.sce @@ -0,0 +1,19 @@ +//Caption:transfer_function
+// example 12.1
+//page 515
+// we are solving this problem from signal flow graph approach
+syms G H;
+// forward path denoted by P1,P2 and so on and loop by L1,L2 and so on
+//path factor by D1,D2 and so on and graph determinant by D
+P1=1*G*1
+P2=1;
+L1=-G;
+L2=-G*H;
+L3=G*H;
+D1=1;
+D2=1;
+D=1-(L1+L2+L3);
+D=simple(D)
+Y=(P1*D1+P2*D2)/D;
+Y=simple(Y);
+disp(Y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH12/EX12.10/exa12_10.sce b/29/CH12/EX12.10/exa12_10.sce new file mode 100755 index 000000000..740a10a74 --- /dev/null +++ b/29/CH12/EX12.10/exa12_10.sce @@ -0,0 +1,12 @@ +//Caption:determine_unit_step_response +//example 12.10 +//page 524 +s=%s; +syms t; +CL=sym('1/((s+1)*(s^2+1))') +disp(CL,"C(s)/R(s)="); +//for unit step response R(s)=1/s; +d=CL*(1/s); +a=s*d; +c=ilaplace(d,s,t); +disp(c,"c(t)=");
\ No newline at end of file diff --git a/29/CH12/EX12.11/exa12_11.sce b/29/CH12/EX12.11/exa12_11.sce new file mode 100755 index 000000000..80e747fc4 --- /dev/null +++ b/29/CH12/EX12.11/exa12_11.sce @@ -0,0 +1,19 @@ +//Caption:determine_unit_step_and_unit_impulse_response +//example 12.11 +//page 524 +s=%s; +syms t; +G=sym('8/(s+1)'); +H=sym('(1/2*s)'); +CL=G/(1+G*H); +disp(CL,"C(s)/R(s)="); +//for unit step response R(s)=1/s; +d=CL*(1/s); +disp(d,"C(s)="); +c=ilaplace(d,s,t); +disp(c,"unit step response,c(t)="); +//for unit impulse response R(s)=1; +e=CL*(1); +disp(e,"C(s)="); +ct=ilaplace(e,s,t); +disp(ct,"unit impulse response,c(t)="); diff --git a/29/CH12/EX12.12/exa12_12.sce b/29/CH12/EX12.12/exa12_12.sce new file mode 100755 index 000000000..d17a00c7c --- /dev/null +++ b/29/CH12/EX12.12/exa12_12.sce @@ -0,0 +1,29 @@ +//caption:determine_Wn,Wd,zeta_and_steady_state_error
+//example 12_12
+//page 526
+s=%s;
+G=sym('20/(s*(s^2+6*s+6))');
+H=0.25;
+CL=G/(1+G*H);
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+printf("the char. eq is:")
+disp("s^2+s+1=0")
+Wn=sqrt(1)//natural_frequency
+//2*zeta*Wn=1
+zeta=1/(2*Wn);//damping ratio
+d=zeta*Wn;//damping_factor
+z=sqrt(1-zeta^2);
+Wd=Wn*z;//damped_frequency_of_oscillation
+Mp=exp((-zeta*%pi)/z)*100;//%_max.peak_overshoot
+ts=4/(zeta*Wn);//settling_time
+tp=%pi/(Wn*sqrt(1-zeta^2));//peak_time
+tu=2*%pi/(Wn*sqrt(1-zeta^2));//first under shoot
+ti=tu-tp;//time interval between max. and min. values
+disp(Wn,"natural_frequency=");
+disp(zeta,"damping ratio=");
+disp(Wd,"damped_frequency_of_oscillation=");
+disp(Mp,"%_max.peak_overshoot=");
+disp(ts,"settling_time=");
+disp(tp,"peak_time=");
+disp(ti,"time_interval_between_max_and_min_values=");
\ No newline at end of file diff --git a/29/CH12/EX12.13/exa12_13.sce b/29/CH12/EX12.13/exa12_13.sce new file mode 100755 index 000000000..fcbe01f99 --- /dev/null +++ b/29/CH12/EX12.13/exa12_13.sce @@ -0,0 +1,17 @@ +//caption:determine_Wn,Wd,zeta_and_steady_state_error
+//example 12_13
+//page 527
+syms Kp K Kd T
+s=%s;
+//exec series.sce;
+//exec parallel.sce;
+a=(Kp+s*Kd)*K
+b=1/(s*(s*T+1))
+G=series(a,b)
+H=1;
+er=1/(1+G*H)
+disp(er,"E(s)/R(s)=");
+R=1/s^2
+E=R*er
+ess=limit(s*E,s,0)
+disp(ess,"steady state error,ess=")
diff --git a/29/CH12/EX12.15/exa12_15.sce b/29/CH12/EX12.15/exa12_15.sce new file mode 100755 index 000000000..6af9c6d79 --- /dev/null +++ b/29/CH12/EX12.15/exa12_15.sce @@ -0,0 +1,25 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 12.15
+//page 529
+s=%s;
+syms K
+G=sym('K/(s*(s^2+s+1)*(s+5)');
+H=1;
+CH=(s*(s^2+s+1)*(s+5)+K)
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2)/routh(2,1)),K,0]
+t=routh(2:3,1:2)
+routh=[routh;-det(t)/t(2,1),0,0]
+routh=[routh;K,0,0]
+disp(routh,"routh=")
+disp("for given system to be stable:");
+disp("((5.1*5-6*K)/5.1)>0 and K>0");
+disp("which gives:");
+disp("0<K<4.25");
diff --git a/29/CH12/EX12.16/exa12_16.sce b/29/CH12/EX12.16/exa12_16.sce new file mode 100755 index 000000000..969f0a12c --- /dev/null +++ b/29/CH12/EX12.16/exa12_16.sce @@ -0,0 +1,25 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 12.16
+//page 530
+s=%s;
+syms K
+CH=s^4+2*s^3+10*s^2+(K-10)*s+K
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2)/routh(2,1)),K,0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0,0]
+//routh=[routh;K,0,0]
+disp(routh,"routh=")
+disp("for given system to be stable,following condition should be satisfied");
+disp("K<30,K<22.9 and K>13.1,K>0")
+disp("which gives,")
+disp("13.1<K<22.9");
diff --git a/29/CH12/EX12.17/exa12_17.sce b/29/CH12/EX12.17/exa12_17.sce new file mode 100755 index 000000000..7e9cd520d --- /dev/null +++ b/29/CH12/EX12.17/exa12_17.sce @@ -0,0 +1,27 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 12.17
+//page 530
+s=%s;
+syms K
+G=sym('K/((s^3+3*s+2)*(s^2+6*s+24))');
+H=1;
+CH=((s^3+3*s+2)*(s^2+6*s+24)+K)
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),routh(1,3),0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0,0]
+//routh=[routh;K,0,0]
+disp(routh,"routh=")
+disp("for given system to be stable,following condition should be satisfied");
+disp("78.84-0.259K>0")
+disp("which gives limiting value of K")
+disp("K<288.9");
diff --git a/29/CH12/EX12.18/exa12_18.sce b/29/CH12/EX12.18/exa12_18.sce new file mode 100755 index 000000000..c3723ac80 --- /dev/null +++ b/29/CH12/EX12.18/exa12_18.sce @@ -0,0 +1,27 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 12.18
+//page 531
+s=%s;
+A=s^5+s^4+4*s^3+4*s^2+s+1;
+b=coeff(A)
+n=length(b)
+routh=[b([6 4 2]);b([5 3 1])]
+routh1=routh;
+c=[routh(1,1),routh(1,3);routh(2,1),routh(2,3)]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),-det(c)/routh(2,1),0]
+disp("since all elements of third row are zero, so we make auxiliary equation")
+A=sym('s^4+4*s^2+1')//auxiliary equation
+B=diff(A,s)
+routh=[routh1;4,8,0]
+d=[routh(2,1),routh(2,3);routh(3,1),routh(3,3)]
+routh=[routh;-det(routh(2:3,1:2))/routh(3,1),-det(d)/routh(3,1),0]
+routh2=routh
+routh=[routh;-det(routh(3:4,1:2))/routh(4,1),0,0]
+routh=[routh;-det(routh(4:5,1:2))/routh(5,1),0,0];
+disp(routh,"routh=")
+disp("stability is examined as below . since roots of auxiliary eq are also roots of characterstics eq")
+A=s^4+4*s^2+1
+b=roots(A)
+disp("since the equation has non repeating roots on s plane imaginary axis.hence system are unstable" )
+
+
diff --git a/29/CH12/EX12.19/exa12_19.sce b/29/CH12/EX12.19/exa12_19.sce new file mode 100755 index 000000000..d398f99e6 --- /dev/null +++ b/29/CH12/EX12.19/exa12_19.sce @@ -0,0 +1,30 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 12.19
+//page 531
+s=%s;
+A=s^5+s^4+4*s^3+4*s^2+4*s+4;
+b=coeff(A)
+n=length(b)
+routh=[b([6,4,2]);b([5 3 1])]
+routh1=routh;
+c=[routh(1,1),routh(1,3);routh(2,1),routh(2,3)]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),-det(c)/routh(2,1),0]
+disp("since all elements of third row are zero, so we make auxiliary equation")
+A=sym('s^4+4*s^2+4')//auxiliary equation
+B=diff(A,s)
+routh=[routh1;4,8,0]
+d=[routh(2,1),routh(2,3);routh(3,1),routh(3,3)]
+routh=[routh;-det(routh(2:3,1:2))/routh(3,1),-det(d)/routh(3,1),0]
+routh2=routh
+routh=[routh;-det(routh(3:4,1:2))/routh(4,1),0,0]
+disp("since all elements of fifth row are zero, so we make auxiliary equation")
+A=sym('2*s^2+4')//auxiliary equation
+B=diff(A,s)
+routh=[routh2;4,0,0]
+routh=[routh;-det(routh(4:5,1:2))/routh(5,1),0,0];
+disp(routh,"routh=")
+disp("stability is examined as below . since roots of auxiliary eq are also roots of characterstics eq")
+A=s^4+4*s^2+4
+b=roots(A)
+disp("since the equation has multiple roots on s plane imaginary axis.hence system are unstable" )
+
diff --git a/29/CH12/EX12.2/exa12_2.sce b/29/CH12/EX12.2/exa12_2.sce new file mode 100755 index 000000000..109549f56 --- /dev/null +++ b/29/CH12/EX12.2/exa12_2.sce @@ -0,0 +1,20 @@ +//Caption:transfer_function
+// example 12.2
+//page 516
+// we are solving this problem from signal flow graph approach
+syms G1 G2 G3 G4
+// forward path denoted by P1,P2 and so on and loop by L1,L2 and so on
+//path factor by D1,D2 and so on and graph determinant by D
+P1=G1;
+P2=G2;
+P3=-G1*G2*G3;
+P4=G1*G2*G4;
+L1=-G1*G2*G3*G4;
+D1=1;
+D2=1;
+D3=1;
+D4=1;
+D=1-(L1);
+Y=(P1*D1+P2*D2+P3*D3+P4*D4)/D;
+Y=simple(Y);
+disp(Y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH12/EX12.21/exa12_21.sce b/29/CH12/EX12.21/exa12_21.sce new file mode 100755 index 000000000..8c306d734 --- /dev/null +++ b/29/CH12/EX12.21/exa12_21.sce @@ -0,0 +1,32 @@ +//caption:determine_frequency_of_oscillations
+//example 12.21
+//page 533
+s=%s;
+syms K
+G=sym('K*(s*(2*s+1))/(s^3+3*s+20)');
+H=1;
+CH=((s^3+3*s+20)+K*(s*(2*s+1)))
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+b=[c0 c1 c2 c3]
+routh=[b([4,2]);b([3,1])]
+routh=[routh;-det(routh(1:2,1:2)/routh(2,1)),0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0]
+disp(routh,"routh=")
+disp("for sustained oscillations:");
+disp("2*K^2+6*K-20=0")
+disp("which gives K")
+disp("K=2");
+disp("freq of oscillations is calculated by solving equation formed by s^2 row of the routh table")
+K=2
+k=2
+A=2*k*s^2+20
+r=roots(A)
+disp(%i*r(2),"frequency of oscillations=" )
+
diff --git a/29/CH12/EX12.23.i/exa12_23_i.jpg b/29/CH12/EX12.23.i/exa12_23_i.jpg Binary files differnew file mode 100755 index 000000000..35eb94b06 --- /dev/null +++ b/29/CH12/EX12.23.i/exa12_23_i.jpg diff --git a/29/CH12/EX12.23.i/exa12_23_i.sce b/29/CH12/EX12.23.i/exa12_23_i.sce new file mode 100755 index 000000000..a6d124d50 --- /dev/null +++ b/29/CH12/EX12.23.i/exa12_23_i.sce @@ -0,0 +1,23 @@ +//caption:stability_using_Nyquist_criterion +//example 12_23_i +//page 535 +clf(); +s=%s; +s1=-s; +disp("for K=0.1") +g=(0.1*(s+10)*(s+40))/(s*(s+1)*(s+4)); +g1=(0.1*(s1+10)*(s1+40))/(s1*(s1+1)*(s1+4)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +//mtlb_axis([-1.5 0.2 -0.3 0.3]); +xtitle('Nyquist plot of (0.1*(s+10)*(s+40))/(s*(s+1)*(s+4))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is not encircled clockwise by Nyquist plot ,so N=0 and P=0") +N=0;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=0;//no. of poles of G(s)H(s) with positive real part +Z=P-N;//np.of zeros of 1+G(s)H(s)=0 with positive real part +disp(Z,"Z=") +disp("as Z=0,there are no roots of closed loop characterstics eq having positive real part, hence system is stable.")
\ No newline at end of file diff --git a/29/CH12/EX12.23.i/exa12_23_i_margin.jpg b/29/CH12/EX12.23.i/exa12_23_i_margin.jpg Binary files differnew file mode 100755 index 000000000..c8103916f --- /dev/null +++ b/29/CH12/EX12.23.i/exa12_23_i_margin.jpg diff --git a/29/CH12/EX12.23.ii/exa12_23_ii.jpg b/29/CH12/EX12.23.ii/exa12_23_ii.jpg Binary files differnew file mode 100755 index 000000000..35eb94b06 --- /dev/null +++ b/29/CH12/EX12.23.ii/exa12_23_ii.jpg diff --git a/29/CH12/EX12.23.ii/exa12_23_ii.sce b/29/CH12/EX12.23.ii/exa12_23_ii.sce new file mode 100755 index 000000000..8413448ea --- /dev/null +++ b/29/CH12/EX12.23.ii/exa12_23_ii.sce @@ -0,0 +1,20 @@ +//caption:stability_using_Nyquist_criterion +//example 12_23_ii +//page 535 +disp("for K=1") +g=(0.1*(s+10)*(s+40))/(s*(s+1)*(s+4)); +g1=(0.1*(s1+10)*(s1+40))/(s1*(s1+1)*(s1+4)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +//mtlb_axis([-3 0.5 -0.6 0.6]); +xtitle('Nyquist plot of (0.1*(s+10)*(s+40))/(s*(s+1)*(s+4))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is encircled twice clockwise by Nyquist plot ,so N=2 and P=0(given)") +N=-2;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=0;//no. of poles of G(s)H(s) with positive real part +Z=P-N;//np.of zeros of 1+G(s)H(s)=0 with positive real part +disp(Z,"Z=") +disp("as Z=2,there are two roots of closed loop characterstics eq having positive real part, hence system is unstable.") diff --git a/29/CH12/EX12.23.ii/exa12_23_ii_margin.jpg b/29/CH12/EX12.23.ii/exa12_23_ii_margin.jpg Binary files differnew file mode 100755 index 000000000..c8103916f --- /dev/null +++ b/29/CH12/EX12.23.ii/exa12_23_ii_margin.jpg diff --git a/29/CH12/EX12.23.iii/exa12_23_iii.jpg b/29/CH12/EX12.23.iii/exa12_23_iii.jpg Binary files differnew file mode 100755 index 000000000..0fe49a99c --- /dev/null +++ b/29/CH12/EX12.23.iii/exa12_23_iii.jpg diff --git a/29/CH12/EX12.23.iii/exa12_23_iii.sce b/29/CH12/EX12.23.iii/exa12_23_iii.sce new file mode 100755 index 000000000..de1fd6f1c --- /dev/null +++ b/29/CH12/EX12.23.iii/exa12_23_iii.sce @@ -0,0 +1,20 @@ +//caption:stability_using_Nyquist_criterion +//example 12_23_iii +//page 535 +disp("for K=10") +g=(10*(s+10)*(s+40))/(s*(s+1)*(s+4)); +g1=(10*(s1+10)*(s1+40))/(s1*(s1+1)*(s1+4)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +//mtlb_axis([-1.5 0.2 -0.3 0.3]); +xtitle('Nyquist plot of (0.1*(s+10)*(s+40))/(s*(s+1)*(s+4))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is encircled once in clockwise and once in anti clockwise direction by Nyquist plot ,so N=0 and P=0") +N=0;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=0;//no. of poles of G(s)H(s) with positive real part +Z=P-N;//np.of zeros of 1+G(s)H(s)=0 with positive real part +disp(Z,"Z=") +disp("as Z=0,there are no roots of closed loop characterstics eq having positive real part, hence system is stable.")
\ No newline at end of file diff --git a/29/CH12/EX12.23.iii/exa12_23_iii_margin.jpg b/29/CH12/EX12.23.iii/exa12_23_iii_margin.jpg Binary files differnew file mode 100755 index 000000000..9185b33cd --- /dev/null +++ b/29/CH12/EX12.23.iii/exa12_23_iii_margin.jpg diff --git a/29/CH12/EX12.27/exa12_27.jpg b/29/CH12/EX12.27/exa12_27.jpg Binary files differnew file mode 100755 index 000000000..a714180f2 --- /dev/null +++ b/29/CH12/EX12.27/exa12_27.jpg diff --git a/29/CH12/EX12.27/exa12_27.sce b/29/CH12/EX12.27/exa12_27.sce new file mode 100755 index 000000000..ebeda64fd --- /dev/null +++ b/29/CH12/EX12.27/exa12_27.sce @@ -0,0 +1,16 @@ +//caption:gain_and_phase_margin +//example 12_27 +//page543 +clf(); +s=%s; +s1=-s; +disp("for K=0.5") +g=(0.5)/(s*(s+1)^2); +GH=syslin('c',g); +nyquist(GH); +//mtlb_axis([-5 1 -500 500]); +xtitle('Nyquist plot of (2.5*3)/(s*(0.4*s+1)*(0.2*s+1))') +pm=p_margin(GH) +disp(pm,"phase margin=") +gm=g_margin(GH) +disp(gm,"gain margin=")
\ No newline at end of file diff --git a/29/CH12/EX12.3/exa12_3.sce b/29/CH12/EX12.3/exa12_3.sce new file mode 100755 index 000000000..807177955 --- /dev/null +++ b/29/CH12/EX12.3/exa12_3.sce @@ -0,0 +1,20 @@ +//Caption:transfer_function
+// example 12.3
+//page 517
+// we are solving this problem from signal flow graph approach
+syms G1 G2 G3 G4 H2 H1 H3
+// forward path denoted by P1,P2 and so on and loop by L1,L2 and so on
+//path factor by D1,D2 and so on and graph determinant by D
+P1=G2*G4;
+P2=G2*G3*G4;
+P3=G1*G3*G4;
+L1=-G4*H1;
+L2=-G3*G4*H1*H2;
+L3=-G1*G3*G4*H1*H2*H3
+D1=1;
+D2=1;
+D3=1;
+D=1-(L1+L2+L3);
+Y=(P1*D1+P2*D2+P3*D3)/D;
+Y=simple(Y);
+disp(Y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH12/EX12.33/exa12_33.jpg b/29/CH12/EX12.33/exa12_33.jpg Binary files differnew file mode 100755 index 000000000..953ba9881 --- /dev/null +++ b/29/CH12/EX12.33/exa12_33.jpg diff --git a/29/CH12/EX12.33/exa12_33.sce b/29/CH12/EX12.33/exa12_33.sce new file mode 100755 index 000000000..0f8ba232f --- /dev/null +++ b/29/CH12/EX12.33/exa12_33.sce @@ -0,0 +1,18 @@ +//caption:determine_close_loop_stability
+//example 12_33
+//page 550
+s=%s;
+g=(720*(s+1.25))/(s*(s+10)*(s^2+2*s+9));
+G=syslin('c',g)
+fmin=0.1;
+fmax=100;
+bode(G, fmin, fmax)
+[gm,freqGM]=g_margin(G);
+[pm,freqPM]=p_margin(G);
+show_margins(G);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq=");
+disp(pm,"phase_margin=");
+disp((freqPM*2*%pi),"phase_margin_freq=");
+show_margins(G);
+disp("since gain and phase margin are both negative so system is unstable")
diff --git a/29/CH12/EX12.4/exa12_4.sce b/29/CH12/EX12.4/exa12_4.sce new file mode 100755 index 000000000..632eb558d --- /dev/null +++ b/29/CH12/EX12.4/exa12_4.sce @@ -0,0 +1,24 @@ +//Caption:transfer_function
+// example 12.4
+//page 518
+// we are solving this problem from signal flow graph approach
+syms G1 G2
+// forward path denoted by P1,P2 and so on and loop by L1,L2 and so on
+//path factor by D1,D2 and so on and graph determinant by D
+P1=G1;
+P2=G2;
+P3=G1*G2;
+P4=G1*G2;
+L1=-G1;
+L2=-G2;
+L3=G1*G2;
+L4=-G1*G2;
+L5=-G1*G2;
+D1=1;
+D2=1;
+D3=1;
+D4=1;
+D=1-(L1+L2+L3+L4+L5);
+Y=(P1*D1+P2*D2+P3*D3+P4*D4)/D;
+Y=simple(Y);
+disp(Y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH12/EX12.42/exa12_42.jpg b/29/CH12/EX12.42/exa12_42.jpg Binary files differnew file mode 100755 index 000000000..20058fc5b --- /dev/null +++ b/29/CH12/EX12.42/exa12_42.jpg diff --git a/29/CH12/EX12.42/exa12_42.sce b/29/CH12/EX12.42/exa12_42.sce new file mode 100755 index 000000000..b35ce3ce3 --- /dev/null +++ b/29/CH12/EX12.42/exa12_42.sce @@ -0,0 +1,50 @@ +//caption:root_locus
+//example 12_42
+//page 562
+s=%s;
+syms K;
+GH=K/(s*(s+2)*(s+4))
+//since Mp=40%, so .4=exp((-zeta*%pi)/(sqrt(1-zeta^2))
+zeta=0.3
+//from given data
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+2)*(s+4))+K
+K=sym('-(s^3+6*s^2+8*s)')
+d=diff(K,s)
+e=-3*s^2-12*s-8
+r1=roots(e)
+disp(r1,"roots=")
+disp("-0.842 is break away point sinc it lies on root locus")
+CH=sym('s^3+6*s^2+8*s+K');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+b=[c0 c1 c2 c3]
+n=4;
+routh=[b([4,2]);b([3,1])];
+routh=[routh;-det(routh)/routh(2,1),0]
+t=routh(2:3,1:2)
+routh=[routh;-det(t)/t(2,1),0]
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(48-K)=0 ");
+disp("which gives:");
+disp("K=48");
+K=48;
+k=48
+a=6*s^2+48//intersection of root locus with imaginary plane
+r=roots(a)
+g=k/(s*(s+2)*(s+4))
+G=syslin('c',g)
+evans(g,8)
+xgrid(2)
+disp("the line theta=acos(zeta)=72.5 intersects root locus at sa=(-0.5+i1.65)")
+disp("the value of K at s=sa is find to be 14.87 for Mp=40%")
+K=14.87
+ts=4/0.5 //ts=4/(zeta*wn)
+Kv=limit(s*GH,s,0)
+Kv=eval(Kv)
+Kv=float(Kv)
+disp(Kv,"Kv=");
diff --git a/29/CH12/EX12.43/exa12_43.jpg b/29/CH12/EX12.43/exa12_43.jpg Binary files differnew file mode 100755 index 000000000..77635d7f6 --- /dev/null +++ b/29/CH12/EX12.43/exa12_43.jpg diff --git a/29/CH12/EX12.43/exa12_43.sce b/29/CH12/EX12.43/exa12_43.sce new file mode 100755 index 000000000..7162eba9c --- /dev/null +++ b/29/CH12/EX12.43/exa12_43.sce @@ -0,0 +1,44 @@ +//caption:root_locus_and_value_of_K
+//example 12.43
+//page 564
+s=%s;
+syms K;
+GH=K/(s*(s+2)*(s^2+2*s+2))
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+2)*(s^2+2*s+2))+K
+CH=sym('s^4+4*s^3+6*s^2+4*s+K');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),routh(1,3),0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0,0]
+routh=[routh;K,0,0]
+K=sym('s^4+4*s^3+6*s^2+4*s')
+d=diff(K,s)
+e=-(4*s^3+12*s^2+12*s+4)
+r=roots(e)
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("((20-4K)/5)=0 ");
+disp("which gives:");
+disp("K=5");
+K=5;
+k=5
+a=5*s^2+5//intersection of root locus with s plane
+r=roots(a)
+disp(r,"intersection point with imaginary axis=")
+g=k/(s*(s+2)*(s^2+2*s+2))
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
+disp("angle of departure=-90 and +90")
+disp("breakaway point is -1 and +j and -j")
+disp("on solving we find K=1")
diff --git a/29/CH12/EX12.44/exa12_44.jpg b/29/CH12/EX12.44/exa12_44.jpg Binary files differnew file mode 100755 index 000000000..fb078ee4c --- /dev/null +++ b/29/CH12/EX12.44/exa12_44.jpg diff --git a/29/CH12/EX12.44/exa12_44.sce b/29/CH12/EX12.44/exa12_44.sce new file mode 100755 index 000000000..038669848 --- /dev/null +++ b/29/CH12/EX12.44/exa12_44.sce @@ -0,0 +1,41 @@ +//caption:root_locus_and_value_of_K
+//example 12.44
+//page 565
+s=%s;
+syms K;
+GH=K/((s^2+2*s+5)*(s^2+2*s+2))
+disp("the characterstics eq. is determined as:")
+CH=((s^2+2*s+5)*(s^2+2*s+2))+K
+CH=sym('((s^2+2*s+5)*(s^2+2*s+2))+K');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),routh(1,3),0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0,0]
+routh=[routh;K,0,0]
+K=sym('-(s^2+2*s+5)*(s^2+2*s+2)')
+d=diff(K,s)
+e=-(4*s^3+12*s^2+22*s+14)
+r=roots(e)
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("((7.5*14-4(K+10)/7.5)=0 ");
+disp("which gives:");
+disp("K=16.25");
+K=16.25;
+k=16.25
+a=7.5*s^2+26.25//intersection of root locus with s plane
+r=roots(a)
+g=k/((s^2+2*s+5)*(s^2+2*s+2))
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
+disp(r,"the point of intersection of root locus with imaginary axis =")
diff --git a/29/CH12/EX12.45/exa12_45.jpg b/29/CH12/EX12.45/exa12_45.jpg Binary files differnew file mode 100755 index 000000000..abd65455e --- /dev/null +++ b/29/CH12/EX12.45/exa12_45.jpg diff --git a/29/CH12/EX12.45/exa12_45.sce b/29/CH12/EX12.45/exa12_45.sce new file mode 100755 index 000000000..6e8c16086 --- /dev/null +++ b/29/CH12/EX12.45/exa12_45.sce @@ -0,0 +1,38 @@ +//caption:root_locus_and_value_of_K
+//example 12.45
+//page 567
+s=%s;
+syms K;
+GH=K*(s+1)/(s*(s+2)*(s^2+4*s+8))
+disp("the characterstics eq. is determined as:")
+CH=((s*(s+2)*(s^2+4*s+8)))+K*(s+1)
+CH=sym('((s*(s+2)*(s^2+4*s+8)))+K*(s+1)');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+c4=coeffs(CH,'s',4);
+b=[c0 c1 c2 c3 c4 ]
+routh=[b([5,3,1]);b([4,2]),0]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),routh(1,3),0]
+routh(3,1)=simple(routh(3,1))
+t=routh(2:3,1:2)
+l=simple(-det(t)/t(2,1))
+routh=[routh;l,0,0]
+routh=[routh;K,0,0]
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(K^2-28*K-1280)=0 ");
+disp("which gives:");
+disp("K=52.4 and -24.42");
+K=52.4;//considering positive value
+k=52.4
+a=((80-52.4)/6)*s^2+52.4//intersection of root locus with imaginary axis
+r=roots(a)
+g=k*(s+1)/(s*(s+2)*(s^2+4*s+8))
+G=syslin('c',g)
+clf();
+evans(g,10)
+xgrid(2)
+disp(r,"the point of intersection of root locus with imaginary axis =")
diff --git a/29/CH12/EX12.46/exa12_46.jpg b/29/CH12/EX12.46/exa12_46.jpg Binary files differnew file mode 100755 index 000000000..d42cbae3a --- /dev/null +++ b/29/CH12/EX12.46/exa12_46.jpg diff --git a/29/CH12/EX12.46/exa12_46.sce b/29/CH12/EX12.46/exa12_46.sce new file mode 100755 index 000000000..6c9c3bd40 --- /dev/null +++ b/29/CH12/EX12.46/exa12_46.sce @@ -0,0 +1,41 @@ +//caption:root_locus_and_value_of_K
+//example 12.46
+//page 570
+s=%s;
+syms K;
+GH=K/(s*((s+6)^2))
+disp("the characterstics eq. is determined as:")
+CH=(s*((s+6)^2))+K
+CH=sym('(s*((s+6)^2))+K');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+b=[c0 c1 c2 c3]
+n=4;
+routh=[b([4,2]);b([3,1])];
+routh=[routh;-det(routh)/routh(2,1),0]
+t=routh(2:3,1:2)
+routh=[routh;-det(t)/t(2,1),0]
+K=sym('-(s*((s+6)^2))')
+d=diff(K,s)
+e=3*s^2+24*s+36
+r1=roots(e)
+disp(r1,"roots=")
+disp("-2 is break away point sinc it lies on root locus")
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(-(K-432)/12)=0 ");
+disp("which gives:");
+disp("K=432");
+K=432;//considering positive value
+k=432
+a=12*s^2+k//intersection of root locus with imaginary axis plane
+r=roots(a)
+g=k/(s*((s+6)^2))
+G=syslin('c',g)
+clf();
+evans(g,5)
+xgrid(2)
+disp(r,"the point of intersection of root locus with imaginary axis =")
diff --git a/29/CH12/EX12.48/exa12_48.jpg b/29/CH12/EX12.48/exa12_48.jpg Binary files differnew file mode 100755 index 000000000..20058fc5b --- /dev/null +++ b/29/CH12/EX12.48/exa12_48.jpg diff --git a/29/CH12/EX12.48/exa12_48.sce b/29/CH12/EX12.48/exa12_48.sce new file mode 100755 index 000000000..6b7d805b8 --- /dev/null +++ b/29/CH12/EX12.48/exa12_48.sce @@ -0,0 +1,49 @@ +//caption:root_locus_and_value_of_K
+//example 12_48
+//page 574
+s=%s;
+syms K;
+GH=K/(s*(s+2)*(s+4))
+zeta=0.277
+//from given data
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+2)*(s+4))+K
+K=sym('-(s^3+6*s^2+8*s)')
+d=diff(K,s)
+e=-3*s^2-12*s-8
+r1=roots(e)
+disp(r1,"roots=")
+disp("-0.85 is break away point sinc it lies on root locus")
+CH=sym('s^3+6*s^2+8*s+K');
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+c3=coeffs(CH,'s',3);
+b=[c0 c1 c2 c3]
+n=4;
+routh=[b([4,2]);b([3,1])];
+routh=[routh;-det(routh)/routh(2,1),0]
+t=routh(2:3,1:2)
+routh=[routh;-det(t)/t(2,1),0]
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(48-K)=0 ");
+disp("which gives:");
+disp("K=48");
+K=48;
+k=48
+a=6*s^2+48//intersection of root locus with imaginary plane
+r=roots(a)
+g=k/(s*(s+2)*(s+4))
+G=syslin('c',g)
+evans(g,8)
+xgrid(2)
+disp("the line theta=acos(zeta)=73.9 intersects root locus at sa=(-0.5+i1.66)")
+disp("the value of K at s=sa is find to be 15 for zeta=0.277")
+K=15
+k=15
+disp(r,"the point of intersection of root locus with imaginary axis =")
+g=k/(s*(s+2)*(s+4))
+cl=g/(1+g)
+disp(cl,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH12/EX12.49/exa12_49.jpg b/29/CH12/EX12.49/exa12_49.jpg Binary files differnew file mode 100755 index 000000000..66d777f26 --- /dev/null +++ b/29/CH12/EX12.49/exa12_49.jpg diff --git a/29/CH12/EX12.49/exa12_49.sce b/29/CH12/EX12.49/exa12_49.sce new file mode 100755 index 000000000..eb8e50b86 --- /dev/null +++ b/29/CH12/EX12.49/exa12_49.sce @@ -0,0 +1,28 @@ +//caption:root_locus_and_value_of_K
+//example 12.49
+//page 576
+s=%s;
+syms K;
+GH=(K*(s+4))/(s+2)^2
+disp("the characterstics eq. is determined as:")
+CH=(s+2)^2+(K*(s+4))
+CH=sym('((s+2)^2)+K*(s+4)');
+disp('=0',CH,"characterstics_eq,CH=")
+K=sym('((s+2)^2/(s+4))')
+d=diff(K,s)
+e=(s+2)*(s+6)
+r1=roots(e)
+disp(r1,"roots=")
+disp("-2 and -6 is break away point")
+g=(s+4)/((s+2)^2)
+G=syslin('c',g)
+clf();
+evans(g,10)
+xgrid(2)
+disp("for wd=2rad/sec,the point on root locus is s=-4+j2")
+disp("the value of K at s=-4+j2 is 4")
+K=4
+k=4
+g=k*(s+4)/((s+2)^2)
+cl=g/(1+g)
+disp(cl,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH12/EX12.5/exa12_5.sce b/29/CH12/EX12.5/exa12_5.sce new file mode 100755 index 000000000..0a6904c29 --- /dev/null +++ b/29/CH12/EX12.5/exa12_5.sce @@ -0,0 +1,19 @@ +//Caption:transfer_function
+// example 12.5
+//page 518
+// we are solving this problem from signal flow graph approach
+syms G1 G2 G3 G4 G5 H1 H2
+// forward path denoted by P1,P2 and so on and loop by L1,L2 and so on
+//path factor by D1,D2 and so on and graph determinant by D
+P1=G1*G4*G5;
+P2=G1*G2*G3*G5;
+L1=-G3*G5;
+L2=-G3*G5*H2;
+L3=-G1*G4*G5*H1;
+L4=-G1*G2*G3*G5*H1;
+D1=1;
+D2=1;
+D=1-(L1+L2+L3+L4);
+Y=(P1*D1+P2*D2)/D;
+Y=simple(Y);
+disp(Y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH12/EX12.50/exa12_50.jpg b/29/CH12/EX12.50/exa12_50.jpg Binary files differnew file mode 100755 index 000000000..ed60a3e8f --- /dev/null +++ b/29/CH12/EX12.50/exa12_50.jpg diff --git a/29/CH12/EX12.50/exa12_50.sce b/29/CH12/EX12.50/exa12_50.sce new file mode 100755 index 000000000..2703a28eb --- /dev/null +++ b/29/CH12/EX12.50/exa12_50.sce @@ -0,0 +1,26 @@ +//caption:root_locus_and_close_loop_transfer_function
+//example 12.50
+//page 578
+s=%s
+K=8
+G=K/(s*(s+4))
+H=1;
+GH=G*H
+G=syslin('c',G)
+evans(G,8)
+xgrid(2)
+CH=s*(s+4)+K
+disp('=0',CH,"characterstics_eq,CH=")
+r=roots(CH)
+disp(r,"the point at which K=8")
+cl=G/(1+GH)
+disp(cl,"C(s)/R(s)=")
+
+
+
+disp("part b")
+g=K/(s+4)
+h=1/s
+gh=g*h
+CL=g/(1+gh)
+disp(CL,"C(s)/R(s)=")
diff --git a/29/CH12/EX12.51/exa12_51.jpg b/29/CH12/EX12.51/exa12_51.jpg Binary files differnew file mode 100755 index 000000000..8dc2f996f --- /dev/null +++ b/29/CH12/EX12.51/exa12_51.jpg diff --git a/29/CH12/EX12.51/exa12_51.sce b/29/CH12/EX12.51/exa12_51.sce new file mode 100755 index 000000000..0f03ac36e --- /dev/null +++ b/29/CH12/EX12.51/exa12_51.sce @@ -0,0 +1,14 @@ +//caption:root_locus_and_gain,phase_margin
+//example 12.51
+//page 580
+s=%s;
+K=3.46
+G=K/(s*(s+1)*(s+2))
+G=syslin('c',G)
+clf();
+evans(G,20)
+xgrid(2)
+[gm,freq_gm]=g_margin(G)
+[pm,freq_pm]=p_margin(G)
+disp(gm,"gain_margin=",freq_gm*2*%pi,"gain_margin_freq=")
+disp(pm,"phase_margin=",freq_pm*2*%pi,"phase_margin_freq=")
diff --git a/29/CH12/EX12.54/exa12_54.sce b/29/CH12/EX12.54/exa12_54.sce new file mode 100755 index 000000000..0a3bdd501 --- /dev/null +++ b/29/CH12/EX12.54/exa12_54.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 12_54
+//page 583
+s=%s;
+g=5*(s+2)/(s*(s+1)*(s+5));
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH12/EX12.55/exa12_55.sce b/29/CH12/EX12.55/exa12_55.sce new file mode 100755 index 000000000..db018fef6 --- /dev/null +++ b/29/CH12/EX12.55/exa12_55.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 12_55
+//page 585
+s=%s;
+g=50/(s*(s^2+0.5*s+50));
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH12/EX12.56/exa12_56.sce b/29/CH12/EX12.56/exa12_56.sce new file mode 100755 index 000000000..e7c9302a6 --- /dev/null +++ b/29/CH12/EX12.56/exa12_56.sce @@ -0,0 +1,26 @@ +//caption:obtain_state_transistion_matrix
+//example 12_56
+//page 586
+s=%s;
+syms t
+A=[0 1;0 -3]
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+//for calculating state transistion matrix
+ip=[0 0;0 0]
+i=1;
+j=1;
+for i=1:2
+ for j=1:2
+ if(i==2 & j==1)
+ else
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ end
+ i=i+1;
+end
+r(2,1)=0
+disp(ip,"state transistion matrix,ip(t)=");
\ No newline at end of file diff --git a/29/CH12/EX12.57/exa12_57.sce b/29/CH12/EX12.57/exa12_57.sce new file mode 100755 index 000000000..e647af62c --- /dev/null +++ b/29/CH12/EX12.57/exa12_57.sce @@ -0,0 +1,19 @@ +//caption:obtain_time_response
+//example 12_57
+//page 586
+s=%s;
+syms t
+A=[0 1;-2 -3]
+B=[1 0]'
+x0=[0 0]'
+u=1/(s+1)
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+m=r*B*(1/(s+1));
+//for calculating zero state response
+x=[0;0]
+x(1,1)=ilaplace(m(1,1),s,t);
+x(2,1)=ilaplace(m(2,1),s,t);
+disp(x,"time response of the system,x(t)=");
diff --git a/29/CH12/EX12.59/exa12_59.sce b/29/CH12/EX12.59/exa12_59.sce new file mode 100755 index 000000000..f63c58a72 --- /dev/null +++ b/29/CH12/EX12.59/exa12_59.sce @@ -0,0 +1,20 @@ +//caption:obtain_time_response
+//example 12_59
+//page 590
+s=%s;
+syms t
+A=[-1 0;1 -1]
+B=[0 1]'
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+m=r*B*(1/s)
+r1=r*x0
+X=r1+m
+//for calculating zero state response
+x=[0;0]
+x(1,1)=ilaplace(X(1,1),s,t);
+x(2,1)=ilaplace(X(2,1),s,t);
+disp(x,"zero input response of the system,x(t)=");
diff --git a/29/CH12/EX12.61/exa12_61.sce b/29/CH12/EX12.61/exa12_61.sce new file mode 100755 index 000000000..fc81b8e8d --- /dev/null +++ b/29/CH12/EX12.61/exa12_61.sce @@ -0,0 +1,14 @@ +//caption:obtain_transfer_matrix
+//example 12_61
+//page 592
+s=%s;
+syms t
+A=[-1 -1;3 -5]
+B=[1 1]'
+C=[1 2]
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+G=C*r*B
+disp(G,"transfer_matrix=")
\ No newline at end of file diff --git a/29/CH12/EX12.7/exa12_7.sce b/29/CH12/EX12.7/exa12_7.sce new file mode 100755 index 000000000..4f918bd5a --- /dev/null +++ b/29/CH12/EX12.7/exa12_7.sce @@ -0,0 +1,23 @@ +//Caption:determine_peak_time_and_peak_overshoot +//example 12.7 +//page 520 +s=%s; +syms t; +G=sym('(s+2)/(s*(s+1))')//G(s) +H=1; +CL=G/(1+G*H); +disp(CL,"C(s)/R(s)="); +//for unit step response R(s)=1/s; +d=CL*(1/s); +a=s*d; +disp(d,"C(s)="); +c=ilaplace(d,s,t); +disp(c,"c(t)="); +//for peak time we get tp=3*%pi/4 +tp=3*%pi/4 +Cmax=1-(exp(-tp)*cos(tp)); +Css=limit(a,s,0); +disp(Css,"Css="); +Mp=((Cmax-Css)/Css)*100 +Mp=float(Mp) +disp(Mp,"peak_overshoot=") diff --git a/29/CH12/EX12.8/exa12_8.sce b/29/CH12/EX12.8/exa12_8.sce new file mode 100755 index 000000000..e8d049937 --- /dev/null +++ b/29/CH12/EX12.8/exa12_8.sce @@ -0,0 +1,24 @@ +//Caption:time_response_and_peak_overshoot +//example 12.8 +//page 521 +s=%s; +syms t; +num=sym('8*(s+1)'); +den=sym('(s^2+2*s+2)'); +CL=num/den; +disp(CL,"C(s)/R(s)="); +//for unit step response R(s)=1/s; +d=CL*(1/s); +disp(d,"C(s)="); +c=ilaplace(d,s,t); +disp(c,"c(t)="); +//for peak time we get tp=%pi/2 +t=%pi/2 +a=s*d; +a=simple(a) +Cmax=4*(1+1.414*exp(-t)*sin(t-(%pi/4))) +Css=limit(a,s,0); +disp(Css,"Css="); +Mp=((Cmax-Css)/Css)*100 +Mp=float(Mp) +disp(Mp,"peak_overshoot=") diff --git a/29/CH12/EX12.9/exa12_9.sce b/29/CH12/EX12.9/exa12_9.sce new file mode 100755 index 000000000..77dba4d20 --- /dev/null +++ b/29/CH12/EX12.9/exa12_9.sce @@ -0,0 +1,32 @@ +//Caption:determine_peak_overshoot +//example 12.9 +//page 523 +s=%s; +syms t K; +CL=sym('(s+1)/(s^2+2*s+5)'); +CL=K*CL; +disp(CL,"C(s)/R(s)=") +//for unit step response R(s)=1/s; +d=CL*(1/s) +Css=limit(s*d,s,0) +disp(Css,"Css="); +//since Css=0.8 (given) +K=0.8*5; +CL=eval(CL); +disp(CL,"C(s)/R(s)="); +//for unit step response R(s)=1/s; +d=CL*(1/s) +disp(d,"C(s)="); +c=ilaplace(d,s,t); +disp(c,"c(t)="); +//for peak time we get tp=0.785 +t=0.785 +a=s*d; +a=simple(a) +Cmax=(4/5)*(1-exp(-t)*cos(2*%pi/4)+exp(-t)*2*sin(2*%pi/4)) +Css=limit(a,s,0) +disp(Css,"Css="); +Mp=((Cmax-Css)/Css)*100 +Mp=float(Mp) +disp(Mp,"peak_overshoot=") + |