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 | |
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')
279 files changed, 4627 insertions, 0 deletions
diff --git a/29/CH1/EX1.6.1.i/exa1_6_1_i.sce b/29/CH1/EX1.6.1.i/exa1_6_1_i.sce new file mode 100755 index 000000000..3d9ccefe1 --- /dev/null +++ b/29/CH1/EX1.6.1.i/exa1_6_1_i.sce @@ -0,0 +1,11 @@ +//Caption:inverse_laplace_transform
+// example 1.6.1.(i)
+//page 7
+// F(s)=1/(s*(s+1))
+s =%s ;
+syms t ;
+[A]=pfss(1/((s)*(s+1))) // partial fraction of F(s)
+F1 = ilaplace (A(1),s,t)
+F2 = ilaplace (A(2),s,t)
+F=F1+F2;
+disp (F," f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.1.ii/exa1_6_1_ii.sce b/29/CH1/EX1.6.1.ii/exa1_6_1_ii.sce new file mode 100755 index 000000000..1a158f099 --- /dev/null +++ b/29/CH1/EX1.6.1.ii/exa1_6_1_ii.sce @@ -0,0 +1,13 @@ +//Caption:inverse_laplace_transform
+// example 1.6.1.(ii)
+//page 7
+// F(s)=s+6/(s(s^2+4s+3))
+s =%s ;
+syms t ;
+[A]= pfss((s+6)/(s*(s^2+4*s+3))) // partial fraction of F(s)
+A(1)=2/s;
+F1 = ilaplace (A(1),s,t)
+F2 = ilaplace (A(2),s,t)
+F3 = ilaplace (A(3),s,t)
+F=F1+F2+F3;
+disp (F," f (t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.1.iii/exa1_6_1_iii.sce b/29/CH1/EX1.6.1.iii/exa1_6_1_iii.sce new file mode 100755 index 000000000..5a8d8a101 --- /dev/null +++ b/29/CH1/EX1.6.1.iii/exa1_6_1_iii.sce @@ -0,0 +1,9 @@ +//Caption:inverse_laplace_transform
+// example 1.6.1.(iii)
+//page 8
+// F(s)=1/(s^2+4s+8)
+s =%s ;
+syms t ;
+disp(1/(s^2+4*s+8),"F(s)=")
+f=ilaplace(1/(s^2+4*s+8),s,t)
+disp (f," f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.1.iv/exa1_6_1_iv.sce b/29/CH1/EX1.6.1.iv/exa1_6_1_iv.sce new file mode 100755 index 000000000..b9833b921 --- /dev/null +++ b/29/CH1/EX1.6.1.iv/exa1_6_1_iv.sce @@ -0,0 +1,9 @@ +//Caption:inverse_laplace_transform
+// example 1.6.1.(iv)
+//page 8
+// F(s)=s+2/(s^2+4s+6)
+s =%s ;
+syms t ;
+disp((s+2)/(s^2+4*s+6),"F(s)=")
+F=ilaplace((s+2)/(s^2+4*s+6),s,t)
+disp (F," f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.1.v/exa1_6_1_v.sce b/29/CH1/EX1.6.1.v/exa1_6_1_v.sce new file mode 100755 index 000000000..287e736dc --- /dev/null +++ b/29/CH1/EX1.6.1.v/exa1_6_1_v.sce @@ -0,0 +1,11 @@ +//Caption:inverse_laplace_transform
+// example 1.6.1.(v)
+//page 8
+// F(s)=5/(s(s^2+4s+5))
+s =%s ;
+syms t ;
+[A]= pfss (5/(s*(s^2+4*s+5))) // partial fraction of F(s)
+F1= ilaplace (A(1),s,t)
+F2= ilaplace (A(2),s,t)
+F=F1+F2;
+disp (F,"f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.1.vi/exa1_6_1_vi.sce b/29/CH1/EX1.6.1.vi/exa1_6_1_vi.sce new file mode 100755 index 000000000..377446c3e --- /dev/null +++ b/29/CH1/EX1.6.1.vi/exa1_6_1_vi.sce @@ -0,0 +1,22 @@ +//Caption:program_laplace_transform
+//example 1.6.1.(v)
+//page 9
+//this problem is solved in two parts because in this problem pfss function donot work.So, First we find partial fraction using method as we do in maths and then secondly we find inverse laplace transform as usual.
+// partial fraction
+s=%s
+syms t;
+num=(s^2+2*s+3);
+den=(s+2)^3;
+g=syslin('c',num/den);
+rd=roots(den);
+[n d k]=factors(g)
+a(3)=horner(g*d(1)^3,rd(1))
+a(2)=horner(derivat(g*d(1)^3),rd(1))
+a(1)=horner(derivat(derivat(g*d(1)^3)),rd(1))
+//inverse laplace
+// partial fraction will be: a(1)/(s+1)+a(2)/((s+2)^2)+a(3)/((s+2)^3)
+F1 = ilaplace (1/d(1),s,t)
+F2 = ilaplace (-2/(d(1)^2),s,t)
+F3 = ilaplace (2*1.5/(d(1)^3),s,t)
+F=F1+F2+F3
+disp (F," f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.10/exa1_6_10.sce b/29/CH1/EX1.6.10/exa1_6_10.sce new file mode 100755 index 000000000..0277af8de --- /dev/null +++ b/29/CH1/EX1.6.10/exa1_6_10.sce @@ -0,0 +1,10 @@ +//Caption:final_value
+// example 1.6.10
+//page 13
+syms t s;
+F=4/(s^2+2*s)
+x=s*F
+x=simple(x)
+z=limit(x,s,0);//final value theorem
+z=dbl(z);
+disp(z,"f(0+)=")
\ No newline at end of file diff --git a/29/CH1/EX1.6.2/exa1_6_2.sce b/29/CH1/EX1.6.2/exa1_6_2.sce new file mode 100755 index 000000000..3c56d7432 --- /dev/null +++ b/29/CH1/EX1.6.2/exa1_6_2.sce @@ -0,0 +1,13 @@ +//Caption:solution_of_differential equation
+// example 1.6.2
+//page 9
+//after taking laplace transform and applying given condition, we get :
+//X(s)=2s+5/(s(s+4))
+s=%s;
+syms t
+[A]=pfss((2*s+5)/(s*(s+4)))
+A(1)=1.25/s
+F1 =ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+f=F1+F2;
+disp (f,"f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.3/exa1_6_3.sce b/29/CH1/EX1.6.3/exa1_6_3.sce new file mode 100755 index 000000000..5bf8ee7af --- /dev/null +++ b/29/CH1/EX1.6.3/exa1_6_3.sce @@ -0,0 +1,9 @@ +//Caption:solution_of_differential_equation
+// example 1.6.3
+//page 10
+//after taking laplace transform and applying given condition, we get :
+//X(s)=1/(s^2+2s+2)
+s=%s;
+syms t
+f = ilaplace(1/(s^2+2*s+2),s,t);
+disp (f,"f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.4/exa1_6_4.sce b/29/CH1/EX1.6.4/exa1_6_4.sce new file mode 100755 index 000000000..c18a9026b --- /dev/null +++ b/29/CH1/EX1.6.4/exa1_6_4.sce @@ -0,0 +1,13 @@ +//Caption:solution_of_differential_equation
+// example 1.6.4
+//page 10
+//after taking laplace transform and applying given condition, we get :
+//Y(s)=(6*s+6)/((s-1)*(s+2)*(s+3))
+s=%s;
+syms t
+[A]=pfss((6*s+6)/((s-1)*(s+2)*(s+3)))
+F1 = ilaplace(A(1),s,t)
+F2 = ilaplace(A(2),s,t)
+F3 = ilaplace(A(3),s,t)
+F=F1+F2+F3;
+disp (F,"f(t)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.5/exa1_6_5.sce b/29/CH1/EX1.6.5/exa1_6_5.sce new file mode 100755 index 000000000..254ca960a --- /dev/null +++ b/29/CH1/EX1.6.5/exa1_6_5.sce @@ -0,0 +1,17 @@ +//Caption:initial_value
+// example 1.6.5
+//page 11
+//I(s)=(C*s/(RCs+1))*E(s)
+//given: E(s)=100/s,R=2 megaohm ,C=1 uF
+// so, I(s)=(((1*10^-6)*s)/(2*s+1))*(100/s)
+syms t
+p=poly([0 10^-6],'s','coeff');
+q=poly([1 2],'s','coeff');
+r=poly([0 1],'s','coeff');
+F1=p/q;
+F2=1/r;
+F=F1*F2
+f=ilaplace(F,s,t);
+z=limit(f,t,0);//initial value theorem
+z=dbl(z);
+disp(z,"i(0+)=")
\ No newline at end of file diff --git a/29/CH1/EX1.6.7/exa1_6_7.sce b/29/CH1/EX1.6.7/exa1_6_7.sce new file mode 100755 index 000000000..ca23975e1 --- /dev/null +++ b/29/CH1/EX1.6.7/exa1_6_7.sce @@ -0,0 +1,12 @@ +//Caption:final_value
+// example 1.6.7
+//page 12
+//X(s)=100/(s*(s^2+2*s+50))
+p=poly([100],'s','coeff');
+q=poly([0 50 2 1],'s','coeff');
+F=p/q;
+syms s
+x=s*F;
+y=limit(x,s,0);//final value theorem
+y=dbl(y)
+disp(y,"x(inf)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.8/exa1_6_8.sce b/29/CH1/EX1.6.8/exa1_6_8.sce new file mode 100755 index 000000000..d0f6f91c5 --- /dev/null +++ b/29/CH1/EX1.6.8/exa1_6_8.sce @@ -0,0 +1,12 @@ +//Caption:steady_state_value
+// example 1.6.7
+//page 12
+//X(s)=s/(s^2*(s^2+6*s+25))
+p=poly([0 1],'s','coeff');
+q=poly([0 0 25 6 1],'s','coeff');
+F=p/q;
+syms s
+x=s*F;
+y=limit(x,s,0);//final value theorem
+y=dbl(y)
+disp(y,"x(inf)=")//result
\ No newline at end of file diff --git a/29/CH1/EX1.6.9/exa1_6_9.sce b/29/CH1/EX1.6.9/exa1_6_9.sce new file mode 100755 index 000000000..7895a9897 --- /dev/null +++ b/29/CH1/EX1.6.9/exa1_6_9.sce @@ -0,0 +1,23 @@ +//Caption:initial_values
+// example 1.6.7
+//page 13
+//F(s)=(4*s+1)/(s^3+2*s)
+s=%s;
+syms t;
+F=(4*s+1)/(s^3+2*s)
+f = ilaplace (F,s,t);
+y=limit(f,t,0);//initial value theorem
+y=dbl(y);
+disp(y,"f(0+)=")
+// since F'(s)=sF(s)-f(0+) where L(f'(t))=F'(s)=F1
+F1=(4*s+1)/(s^2+2)
+f1= ilaplace(F1,s,t);
+y1=limit(f1,t,0);//initial value theorem
+y1=dbl(y1);
+disp(y1,"f_prime(0+)=")
+// since F''(s)=(s^2)*F(s)-s*f(0+)-f'(0+) where L(f''(t))=F''(s)=F2
+F2=(s-8)/(s^2+2)
+f2= ilaplace(F2,s,t);
+y2=limit(f2,t,0);//initial value theorem
+y2=dbl(y2);
+disp(y2,"f_doubleprime(0+)=")
\ No newline at end of file diff --git a/29/CH11/EX11.1/exa11_1.jpg b/29/CH11/EX11.1/exa11_1.jpg Binary files differnew file mode 100755 index 000000000..a12212ed2 --- /dev/null +++ b/29/CH11/EX11.1/exa11_1.jpg diff --git a/29/CH11/EX11.1/exa11_1.sce b/29/CH11/EX11.1/exa11_1.sce new file mode 100755 index 000000000..7a9f5b62b --- /dev/null +++ b/29/CH11/EX11.1/exa11_1.sce @@ -0,0 +1,9 @@ +//Caption:pole_zero_plot
+// example 11_1
+//page 468
+//transfer function:G(s)=((8*(s+3)*(s+4))/(s*(s+2)*(s^2+2*s+2)))
+s=%s;
+G=syslin('c',((8*(s+3)*(s+4))/(s*(s+2)*(s^2+2*s+2))));
+disp(G,"G(s)=");
+x=plzr(G)
+xgrid(2)
\ No newline at end of file diff --git a/29/CH11/EX11.10.a/exa11_10_a.sce b/29/CH11/EX11.10.a/exa11_10_a.sce new file mode 100755 index 000000000..9016f0db2 --- /dev/null +++ b/29/CH11/EX11.10.a/exa11_10_a.sce @@ -0,0 +1,21 @@ +//Caption:calculate_tr,Tp,Mp
+//example 11_10_a
+//page 478
+s=%s;
+G=16/(s^2+1.6*s)
+H=1;
+CL=G/.H
+disp(CL,"C(s)/R(s)=");
+b=denom(CL)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+tr=(%pi-atan(sqrt(1-zeta^2)/zeta))/(Wn*sqrt(1-zeta^2))//rise time
+Tp=%pi/Wd//peak time
+disp(Tp,"peak time=");
+disp(Mp,"max. peak overshoot=")
+disp(tr,"rise time=")
\ No newline at end of file diff --git a/29/CH11/EX11.10.b/exa11_10_b.sce b/29/CH11/EX11.10.b/exa11_10_b.sce new file mode 100755 index 000000000..c6ee7d48f --- /dev/null +++ b/29/CH11/EX11.10.b/exa11_10_b.sce @@ -0,0 +1,30 @@ +//Caption:calculate_Td,tr,Tp,Mp
+//example 11_10_b
+//page 478
+s=%s;
+syms Td
+G=16/(s^2+1.6*s)
+G1=1+s*Td
+H=1;
+a=G*G1
+CL=a/.H
+CL=simple(CL)
+disp(CL,"C(s)/R(s)=");
+zeta=0.8//given
+//since zeta=0.8 so 2*zeta*Wn=1.6+16*Td
+Wn=sqrt(16)
+//so on solving
+Td=0.3
+//so transfer function takes the form:
+CL1=(16+4.8*s)/(s^2+6.4*s+6)
+disp(CL1,"C(s)/R(s)=");
+Wn1=sqrt(16)
+//2*zeta1*Wn1=6.4
+zeta1=6.4/(2*Wn1)//damping ratio
+Wd=Wn1*sqrt(1-zeta1^2)//damped frequency
+Mp=(exp(-(zeta1*%pi)/sqrt(1-zeta1^2)))*100//max. overshoot
+tr=(%pi-atan(sqrt(1-zeta1^2)/zeta1))/(Wn1*sqrt(1-zeta1^2))//rise time
+Tp=%pi/Wd//peak time
+disp(Tp,"peak time=");
+disp(Mp,"max. peak overshoot=")
+disp(tr,"rise time=")
diff --git a/29/CH11/EX11.11/exa11_11.sce b/29/CH11/EX11.11/exa11_11.sce new file mode 100755 index 000000000..969992909 --- /dev/null +++ b/29/CH11/EX11.11/exa11_11.sce @@ -0,0 +1,17 @@ +//Caption:expression_for_unit_step_response
+// example 11_11
+//page 481
+syms G1 G2 G3 H1 t;
+s=%s;
+G1=s+1;
+G2=1/(s+2);
+H2=1/(s*(s+1));
+H1=1/(s+2);
+a=G1/(1+G1*H1);
+b=a/(1+a*H2)
+y=b*G2;
+disp(y,"C(s)/R(s)=")
+//for unit step response R(s)=1/s;
+C=y*(1/s)
+c=ilaplace(C,s,t)
+disp(c,"expression_for_unit_step_response_is=")
\ No newline at end of file diff --git a/29/CH11/EX11.12/exa11_12.sce b/29/CH11/EX11.12/exa11_12.sce new file mode 100755 index 000000000..d08167d37 --- /dev/null +++ b/29/CH11/EX11.12/exa11_12.sce @@ -0,0 +1,15 @@ +//Caption:unit_step_and_impulse_response
+//example 11_12
+//page 482
+s=%s;
+syms t;
+G=(4*s+1)/(4*s^2)
+H=1;
+CL=G/.H
+disp(CL,"C(s)/R(s)=")
+y=ilaplace(CL,s,t);
+disp(y,"unit impulse response,c(t)=");
+//for unit step response R(s)=1/s;
+C=CL*(1/s)
+c=ilaplace(C,s,t)
+disp(c,"expression_for_unit_step_response_is=")
\ No newline at end of file diff --git a/29/CH11/EX11.13/exa11_13.sce b/29/CH11/EX11.13/exa11_13.sce new file mode 100755 index 000000000..7298b0815 --- /dev/null +++ b/29/CH11/EX11.13/exa11_13.sce @@ -0,0 +1,7 @@ +//Caption:determine_transfer_function
+//example 11_13
+//page 483
+syms t;
+f=exp(-t)*(1-cos(2*t))
+F=laplace(f,t,s);
+disp(F,"F(s)=")
\ No newline at end of file diff --git a/29/CH11/EX11.14/exa11_14.sce b/29/CH11/EX11.14/exa11_14.sce new file mode 100755 index 000000000..5dd2a2c1b --- /dev/null +++ b/29/CH11/EX11.14/exa11_14.sce @@ -0,0 +1,31 @@ +//caption:determine_Wn,Wd,Tp,zeta_and_steady_state_error
+//example 11_14
+//page 484
+s=%s;
+syms t;
+G=20/((s+5)*(s+1))
+H=1;
+CL=G/.H
+disp(CL,"C(s)/R(s)=")
+b=denom(CL)
+disp(0,b,"=","the char. eq is:",)
+Wn=sqrt(25)//natural_frequency
+//2*zeta*Wn=6
+zeta=6/(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
+Tp=%pi/Wd//peak time
+tfirst=(2*%pi)/Wd //time for first under shoot
+period=(2*%pi)/Wd //period of oscillation
+ts=4/(zeta*Wn)//settling time
+N=(Wd/(2*%pi))*ts//no. of oscillations completed before reaching steady state
+disp(Wn,"natural frequency=");
+disp(zeta,"damping ratio=");
+disp(Wd,"damped frequency of oscillation=");
+disp(Tp,"peak time=");
+disp(Mp,"%_max.peak overshoot=");
+disp(tfirst,"time for first under shoot=");
+disp(period,"period of oscillation=");
+disp(N,"no. of oscillations completed before reaching steady state=");
\ No newline at end of file diff --git a/29/CH11/EX11.15/exa11_15.sce b/29/CH11/EX11.15/exa11_15.sce new file mode 100755 index 000000000..eed6c5763 --- /dev/null +++ b/29/CH11/EX11.15/exa11_15.sce @@ -0,0 +1,42 @@ +//caption:determine_Wn,Wd,zeta_and_steady_state_error
+//example 11_15
+//page 484
+s=%s;
+G=sym('25/(s*(s+5))');
+G=simple(G);
+H=1;
+CL=G/.H;
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+printf("the char. eq is:")
+disp("s^2+5*s+25")
+Wn=sqrt(25)//natural_frequency
+//2*zeta*Wn=5
+zeta=5/(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
+//steady state error for unit ramp input is:Ess= (2*zeta/Wn)
+Ess=(2*zeta/Wn);//steady state error
+disp("part(a):")
+disp(Wn,"natural_frequency=");
+disp(zeta,"damping ratio=");
+disp(Wd,"damped_frequency_of_oscillation=");
+disp(Mp,"%_max.peak_overshoot=");
+disp(Ess,"steady state error=");
+//if damping ratio is increased from 0.5 to 0.75 by incorporating tachometer feedback
+zeta=0.75;
+H1=sym('s*Kt')//tachometer_feedback
+CL1=G/(1+G*H1);
+CL1=simple(CL1);
+CL2=CL1/(1+H*CL1);
+CL2=simple(CL2);
+disp(CL2,"C(s)/R(s)=");
+Wn=sqrt(25);
+//2*zeta*Wn=25*Kt+5;
+Kt=(2*zeta*Wn-5)/25;//tachometer_gain
+Mp1=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+disp("After applying tachometer feedback:")
+disp(Kt,"tachometer_gain=");
+disp(Mp1,"%_peak_overshoot=");
diff --git a/29/CH11/EX11.16/exa11_16.sce b/29/CH11/EX11.16/exa11_16.sce new file mode 100755 index 000000000..d4fdcb636 --- /dev/null +++ b/29/CH11/EX11.16/exa11_16.sce @@ -0,0 +1,16 @@ +//caption:determine_Kp_Kv_Ka
+//example 11_16
+//page 485
+s=%s;
+syms t;
+num=10
+den=sym('s^2+6*s+10');
+GH=num/den;
+GH=simple(GH);
+disp(GH,"G(s)H(s)=");
+Kp=limit(GH,s,0);//static positional error coefficient
+disp(Kp,"static positional error coefficient=");
+Kv=limit(s*GH,s,0);//static velocity error coefficient
+disp(Kv,"static velocity error coefficient=");
+Ka=limit(s^2*GH,s,0);//static acceleration error coefficient
+disp(Ka,"static acceleration error coefficient=");
diff --git a/29/CH11/EX11.17/exa11_17.sce b/29/CH11/EX11.17/exa11_17.sce new file mode 100755 index 000000000..6ae2d6118 --- /dev/null +++ b/29/CH11/EX11.17/exa11_17.sce @@ -0,0 +1,16 @@ +//caption:determine_Kp_Kv_Ka
+//example 11_16
+//page 485
+s=%s;
+syms t;
+num=sym('100*(s+2)*(s+40)');
+den=sym('(s^3*(s^2+4*s+200))');
+GH=num/den;
+GH=simple(GH);
+disp(GH,"G(s)H(s)=");
+Kp=limit(GH,s,0);//static positional error coefficient
+disp(Kp,"static positional error coefficient=");
+Kv=limit(s*GH,s,0);//static velocity error coefficient
+disp(Kv,"static velocity error coefficient=");
+Ka=limit(s^2*GH,s,0);//static acceleration error coefficient
+disp(Ka,"static acceleration error coefficient=");
diff --git a/29/CH11/EX11.18/exa11_18.sce b/29/CH11/EX11.18/exa11_18.sce new file mode 100755 index 000000000..d7dc190ce --- /dev/null +++ b/29/CH11/EX11.18/exa11_18.sce @@ -0,0 +1,30 @@ +//caption:determine_Kp_Kv_Ka
+//example 11_18
+//page 488
+s=%s;
+syms t;
+num=sym('2*(s^2+3*s+20)');
+den=sym('s*(s+2)*(s^2+4*s+10)');
+GH=num/den;
+GH=simple(GH);
+disp(GH,"G(s)H(s)=");
+input1=5;
+Kp=limit(GH,s,0);//static positional error coefficient
+Ess=5*(1/(1+Kp));//steady state error
+e=(1/(%inf+1));
+e=0;
+Ess=e;
+disp(Kp,"static positional error coefficient=");
+disp(Ess,"steady state error=");
+input2=4*t;
+Kv=limit(s*GH,s,0);//static velocity error coefficient
+Ess=(1/Kv)*4;//steady state error
+disp(Kv,"static velocity error coefficient=");
+disp(Ess,"steady state error=");
+input3=(4*t^2)/2;
+Ka=limit(s^2*GH,s,0);//static acceleration error coefficient
+Ess=(1/Ka)*4;//steady state error
+disp(Ka,"static acceleration error coefficient=");
+disp("steady state error=");
+disp("infinity")
+
diff --git a/29/CH11/EX11.19/exa11_19.sce b/29/CH11/EX11.19/exa11_19.sce new file mode 100755 index 000000000..4f36c748c --- /dev/null +++ b/29/CH11/EX11.19/exa11_19.sce @@ -0,0 +1,8 @@ +//Caption:determine_transfer_function
+//example 11_19
+//page 489
+syms t;
+s=%s;
+c=0.5+(1.25*exp(-t))-(1.75*exp(-12*t));
+C=laplace(c,t,s);
+disp(C,"C(s)=")
\ No newline at end of file diff --git a/29/CH11/EX11.2/exa11_2.sce b/29/CH11/EX11.2/exa11_2.sce new file mode 100755 index 000000000..f0cc432e2 --- /dev/null +++ b/29/CH11/EX11.2/exa11_2.sce @@ -0,0 +1,13 @@ +//Caption:transfer_function
+// example 11_2
+//page 469
+syms G1 G2 G3 H1;
+s=%s;
+G1=4/(s*(s+4));
+G2=s+1.2;
+G3=s+0.8;
+H1=1;
+H2=(G2+G3);
+a=G1/.H1;
+y=a/(1+a*H2)
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH11/EX11.21.a/exa11_21_a.sce b/29/CH11/EX11.21.a/exa11_21_a.sce new file mode 100755 index 000000000..8d455ff5a --- /dev/null +++ b/29/CH11/EX11.21.a/exa11_21_a.sce @@ -0,0 +1,17 @@ +//Caption:roots_of_characterstics_equation
+//example 11_21_a
+//page 491
+s=%s;
+num=210
+den=sym('s*(s+2)*(s^2+12*s+6)');
+G=num/den;
+G=simple(G);
+H=1;
+n1=poly([210],'s',"coeff");
+d1=poly([210 192 390 44 1],'s',"coeff");
+CL=syslin('c',n1,d1)
+disp(CL,"C(s)/R(s)=")
+b=denom(CL)
+disp(0,"=",b,"the char. eq is:",)
+r=roots(b);
+disp(r,"roots of char. eq. are=");
diff --git a/29/CH11/EX11.21.b/exa11_21_b.jpg b/29/CH11/EX11.21.b/exa11_21_b.jpg Binary files differnew file mode 100755 index 000000000..88c73dff9 --- /dev/null +++ b/29/CH11/EX11.21.b/exa11_21_b.jpg diff --git a/29/CH11/EX11.21.b/exa11_21_b.sce b/29/CH11/EX11.21.b/exa11_21_b.sce new file mode 100755 index 000000000..b7567a3d7 --- /dev/null +++ b/29/CH11/EX11.21.b/exa11_21_b.sce @@ -0,0 +1,16 @@ +//Caption:bode_plot
+//example 11_21_b
+//page 491
+s=%s;
+num=210
+den=(s*(s+2)*(s^2+12*s+6));
+g=num/den;
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+gm=g_margin(G)
+pm=p_margin(G)
+disp(gm,"gain_margin=");
+disp(pm,"phase_margin=");
\ No newline at end of file diff --git a/29/CH11/EX11.22/exa11_22.jpg b/29/CH11/EX11.22/exa11_22.jpg Binary files differnew file mode 100755 index 000000000..fcab09709 --- /dev/null +++ b/29/CH11/EX11.22/exa11_22.jpg diff --git a/29/CH11/EX11.22/exa11_22.sce b/29/CH11/EX11.22/exa11_22.sce new file mode 100755 index 000000000..a447467f0 --- /dev/null +++ b/29/CH11/EX11.22/exa11_22.sce @@ -0,0 +1,18 @@ +//caption:gain_margin_and_phase_margin
+//example 11_22
+//page 493
+s=%s;
+g=((2*(s+0.25))/(s^2*(s+1)*(s+0.5)));
+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/CH11/EX11.24/exa11_24.jpg b/29/CH11/EX11.24/exa11_24.jpg Binary files differnew file mode 100755 index 000000000..d03e674ba --- /dev/null +++ b/29/CH11/EX11.24/exa11_24.jpg diff --git a/29/CH11/EX11.24/exa11_24.sce b/29/CH11/EX11.24/exa11_24.sce new file mode 100755 index 000000000..5dde825b9 --- /dev/null +++ b/29/CH11/EX11.24/exa11_24.sce @@ -0,0 +1,22 @@ +//caption:stability_using_Nyquist_criterion +//example 11_24 +//page 496 +clf; +s=%s; +s1=-s; +g=50/((s+1)*(s+2)); +g1=50/((s1+1)*(s1+2)); +GH=syslin('c',g) +GH1=syslin('c',g1) +nyquist(GH); +nyquist(GH1); +mtlb_axis([-5 30 -20 20]); +xtitle('Nyquist plot of 50/((s+1)*(s+2))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is not encircled by Nyquist plot ,so N=0 and P=0(given)") +N=0;//no. of encirclement of -1+%i0 by G(s)H(s) plot +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/CH11/EX11.25/exa11_25.jpg b/29/CH11/EX11.25/exa11_25.jpg Binary files differnew file mode 100755 index 000000000..b2eccce6c --- /dev/null +++ b/29/CH11/EX11.25/exa11_25.jpg diff --git a/29/CH11/EX11.25/exa11_25.sce b/29/CH11/EX11.25/exa11_25.sce new file mode 100755 index 000000000..796050712 --- /dev/null +++ b/29/CH11/EX11.25/exa11_25.sce @@ -0,0 +1,14 @@ +//caption:stability_using_Nyquist_criterion +//example 11_25 +//page 497 +clf(); +s=%s; +s1=-s; +g=(2.2/(s*(s+1)*(s^2+2*s+2))) +g1=(2.2/(s1*(s1+1)*(s1^2+2*s1+2))) +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +mtlb_axis([-2.5 0.2 -75 75]); +disp("as the nyquist plot passes through the point -1+%i*0, so system is marginally stable and output represents sustained oscillations.")
\ No newline at end of file diff --git a/29/CH11/EX11.26.i/exa11_26_i.jpg b/29/CH11/EX11.26.i/exa11_26_i.jpg Binary files differnew file mode 100755 index 000000000..6716f0a49 --- /dev/null +++ b/29/CH11/EX11.26.i/exa11_26_i.jpg diff --git a/29/CH11/EX11.26.i/exa11_26_i.sce b/29/CH11/EX11.26.i/exa11_26_i.sce new file mode 100755 index 000000000..1b8222b22 --- /dev/null +++ b/29/CH11/EX11.26.i/exa11_26_i.sce @@ -0,0 +1,22 @@ +//caption:stability_using_Nyquist_criterion +//example 11_26_i +//page 497 +clf(); +s=%s; +s1=-s; +disp("for K=10") +g=(10*(s-1))/((s+2)*(s+3)); +g1=(10*(s1-1))/((s1+2)*(s1+3)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +mtlb_axis([-2 2 -2.5 2.5]); +xtitle('Nyquist plot of (10*(s-1))/((s+2)*(s+3));') +disp("since the point(-1+%i0) is encircled clockwise by Nyquist plot ,so N=-1 and P=1(given)") +N=-1;//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=1,there is one roots of closed loop characterstics eq having positive real part, hence system is unstable.") + diff --git a/29/CH11/EX11.26.ii/exa11_26_ii.jpg b/29/CH11/EX11.26.ii/exa11_26_ii.jpg Binary files differnew file mode 100755 index 000000000..5dd6a5001 --- /dev/null +++ b/29/CH11/EX11.26.ii/exa11_26_ii.jpg diff --git a/29/CH11/EX11.26.ii/exa11_26_ii.sce b/29/CH11/EX11.26.ii/exa11_26_ii.sce new file mode 100755 index 000000000..42b1ba732 --- /dev/null +++ b/29/CH11/EX11.26.ii/exa11_26_ii.sce @@ -0,0 +1,21 @@ +//caption:stability_using_Nyquist_criterion +//example 11_26_ii +//page 497 +clf(); +s=%s; +s1=-s; +disp("for K=4") +g=(4*(s-1))/((s+2)*(s+3)); +g1=(4*(s1-1))/((s1+2)*(s1+3)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +mtlb_axis([-1 1 -1 1]); +xtitle('Nyquist plot of (2.5*(s+1))/((s+0.5)*(s-2))') +disp("since the point(-1+%i0) is encircled anticlockwise by Nyquist plot ,so N=1 and P=1(given)") +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.") diff --git a/29/CH11/EX11.27/exa11_27.jpg b/29/CH11/EX11.27/exa11_27.jpg Binary files differnew file mode 100755 index 000000000..9df94c382 --- /dev/null +++ b/29/CH11/EX11.27/exa11_27.jpg diff --git a/29/CH11/EX11.27/exa11_27.sce b/29/CH11/EX11.27/exa11_27.sce new file mode 100755 index 000000000..92db16f7b --- /dev/null +++ b/29/CH11/EX11.27/exa11_27.sce @@ -0,0 +1,9 @@ +//caption:root_locus
+//example 11_27
+//page 499
+s=%s;
+clf();
+g=((s^2+4)/(s*(s+1)));
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
diff --git a/29/CH11/EX11.28/exa11_28.jpg b/29/CH11/EX11.28/exa11_28.jpg Binary files differnew file mode 100755 index 000000000..6349acdae --- /dev/null +++ b/29/CH11/EX11.28/exa11_28.jpg diff --git a/29/CH11/EX11.28/exa11_28.sce b/29/CH11/EX11.28/exa11_28.sce new file mode 100755 index 000000000..7d271c3ca --- /dev/null +++ b/29/CH11/EX11.28/exa11_28.sce @@ -0,0 +1,9 @@ +//caption:root_locus
+//example 11_28
+//page 501
+s=%s;
+clf();
+g=1/(s*(s+2)*(s^2+2*s+2));
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
diff --git a/29/CH11/EX11.29/exa11_29.jpg b/29/CH11/EX11.29/exa11_29.jpg Binary files differnew file mode 100755 index 000000000..ee14900a3 --- /dev/null +++ b/29/CH11/EX11.29/exa11_29.jpg diff --git a/29/CH11/EX11.29/exa11_29.sce b/29/CH11/EX11.29/exa11_29.sce new file mode 100755 index 000000000..ffbaa88e8 --- /dev/null +++ b/29/CH11/EX11.29/exa11_29.sce @@ -0,0 +1,8 @@ +//caption:root_locus
+//example 11_29
+//page 502
+s=%s;
+g=1/(s*(s+1)*(s+3));
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
\ No newline at end of file diff --git a/29/CH11/EX11.3/exa11_3.sce b/29/CH11/EX11.3/exa11_3.sce new file mode 100755 index 000000000..96746dbea --- /dev/null +++ b/29/CH11/EX11.3/exa11_3.sce @@ -0,0 +1,15 @@ +//Caption:transfer_function
+// example 11_3
+//page 470
+syms G1 G2 G3 H1;
+s=%s;
+G1=4;
+G2=s
+G3=1/(s*(s+2));
+H1=0.5;
+H2=1;
+a=(G1+G2);
+b=(a*G3);
+c=b/.H1;
+y=c/(1+c*H2)
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH11/EX11.30/exa11_30.jpg b/29/CH11/EX11.30/exa11_30.jpg Binary files differnew file mode 100755 index 000000000..53e64a179 --- /dev/null +++ b/29/CH11/EX11.30/exa11_30.jpg diff --git a/29/CH11/EX11.30/exa11_30.sce b/29/CH11/EX11.30/exa11_30.sce new file mode 100755 index 000000000..0d914079e --- /dev/null +++ b/29/CH11/EX11.30/exa11_30.sce @@ -0,0 +1,8 @@ +//caption:root_locus
+//example 11_30
+//page 503
+s=%s;
+g=1/(s*(s+4)*(s^2+4*s+13));
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
\ No newline at end of file diff --git a/29/CH11/EX11.31/exa11_31.sce b/29/CH11/EX11.31/exa11_31.sce new file mode 100755 index 000000000..a1ed17813 --- /dev/null +++ b/29/CH11/EX11.31/exa11_31.sce @@ -0,0 +1,38 @@ +//caption:design_lead_compensator
+//example 11_31
+//page 339
+s=%s;
+clf();
+syms K;
+g=(K/(s*(1+0.2*s)));
+Kv=limit(s*g,s,0);//static velocity error coefficient
+//since Kv=10
+K=10;
+g=(10/(s*(1+0.2*s)));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+[gm,freqGM]=g_margin(G);
+[pm,freqPM]=p_margin(G);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq=");
+disp(pm,"phase_margin=");
+disp((freqPM*2*%pi),"phase_margin_freq_or_gain_cross_over_frequency=");
+disp("since P.M is less than desired value so we need phase lead network ")
+disp("selecting zero of lead compensating network at w=5.5rad/sec and pole at w=13.8rad/sec and applying gain to account attenuatin factor .")
+gc=(1+0.18*s)/(1+0.072*s)
+Gc=syslin('c',gc)
+disp(Gc,"transfer function of lead compensator=");
+G1=G*Gc
+disp(G1,"overall transfer function=");
+fmin=0.01;
+fmax=100;
+figure();
+bode(G1, fmin, fmax);
+show_margins(G1)
+[gm,freqGM]=g_margin(G1);
+[pm,freqPM]=p_margin(G1);
+disp(pm,"phase_margin_of_compensated_system=");
+disp((freqPM*2*%pi),"gain_cross_over_frequency=");
\ No newline at end of file diff --git a/29/CH11/EX11.31/exa11_31_compensated.jpg b/29/CH11/EX11.31/exa11_31_compensated.jpg Binary files differnew file mode 100755 index 000000000..8d5c8ae82 --- /dev/null +++ b/29/CH11/EX11.31/exa11_31_compensated.jpg diff --git a/29/CH11/EX11.31/exa11_31_uncompensated.jpg b/29/CH11/EX11.31/exa11_31_uncompensated.jpg Binary files differnew file mode 100755 index 000000000..50b40a888 --- /dev/null +++ b/29/CH11/EX11.31/exa11_31_uncompensated.jpg diff --git a/29/CH11/EX11.32/exa11_32.jpg b/29/CH11/EX11.32/exa11_32.jpg Binary files differnew file mode 100755 index 000000000..3f9e2f71f --- /dev/null +++ b/29/CH11/EX11.32/exa11_32.jpg diff --git a/29/CH11/EX11.32/exa11_32.sce b/29/CH11/EX11.32/exa11_32.sce new file mode 100755 index 000000000..b145d6288 --- /dev/null +++ b/29/CH11/EX11.32/exa11_32.sce @@ -0,0 +1,12 @@ +//caption:nicholas_chart
+//example 11_32
+//page 507
+s=%s;
+num=20;
+den=(s*(s+2)*(s+5))
+g=num/den
+G=syslin('c',g)
+fmin=0.01
+fmax=100
+black(G,fmin,fmax)
+xgrid(2)
diff --git a/29/CH11/EX11.33/exa11_33.sce b/29/CH11/EX11.33/exa11_33.sce new file mode 100755 index 000000000..69358878b --- /dev/null +++ b/29/CH11/EX11.33/exa11_33.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 11_33
+//page 509
+s=%s;
+g=(s+2)/((s+1)*(s+3));
+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/CH11/EX11.34/exa11_34.sce b/29/CH11/EX11.34/exa11_34.sce new file mode 100755 index 000000000..40344a3e4 --- /dev/null +++ b/29/CH11/EX11.34/exa11_34.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 11_34
+//page 509
+s=%s;
+g=(s^2+s+2)/(s^3+9*s^2+26*s+24);
+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/CH11/EX11.35/exa11_35.sce b/29/CH11/EX11.35/exa11_35.sce new file mode 100755 index 000000000..78c235041 --- /dev/null +++ b/29/CH11/EX11.35/exa11_35.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 11_35
+//page 510
+s=%s;
+g=1/(s^2+2*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/CH11/EX11.36/exa11_36.sce b/29/CH11/EX11.36/exa11_36.sce new file mode 100755 index 000000000..4ae1383d8 --- /dev/null +++ b/29/CH11/EX11.36/exa11_36.sce @@ -0,0 +1,21 @@ +//caption:state_transition_matrix
+//example 11_36
+//page 511
+s=%s;
+syms t
+A=[1 4;-2 -5]
+[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
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ i=i+1;
+end
+disp(ip,"state transistion matrix,ip(t)=");
\ No newline at end of file diff --git a/29/CH11/EX11.37/exa11_37.sce b/29/CH11/EX11.37/exa11_37.sce new file mode 100755 index 000000000..14abd3a88 --- /dev/null +++ b/29/CH11/EX11.37/exa11_37.sce @@ -0,0 +1,13 @@ +//caption:check_for_contrallability_of_system
+//example 11_37
+//page 512
+A=[1 1;0 -1]
+B=[1;0]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH11/EX11.38/exa11_38.sce b/29/CH11/EX11.38/exa11_38.sce new file mode 100755 index 000000000..7ab10215a --- /dev/null +++ b/29/CH11/EX11.38/exa11_38.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_function
+//example 11_38
+//page 513
+s=%s
+A=[-5 1;-6 0]
+B=[1;2]
+C=[2 1]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B+D//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH11/EX11.39/exa11_39.sce b/29/CH11/EX11.39/exa11_39.sce new file mode 100755 index 000000000..93a54ce28 --- /dev/null +++ b/29/CH11/EX11.39/exa11_39.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 11_39
+//page 513
+s=%s
+A=[0 1;-6 -5]
+B=[0;1]
+C=[2 1]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B+D//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH11/EX11.4/exa11_4.sce b/29/CH11/EX11.4/exa11_4.sce new file mode 100755 index 000000000..b8eda80c9 --- /dev/null +++ b/29/CH11/EX11.4/exa11_4.sce @@ -0,0 +1,25 @@ +//caption:determine_Wn,zeta_and_Mp
+//example 11_4
+//page 471
+s=%s;
+num=1;
+den=sym('s*(1+0.5*s)*(1+0.2*s)');
+c=num/den;
+c=simple(c);
+disp(c,"C(s)/E(s)=");
+G=c;
+H=1;
+CL=G/(1+G*H);
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+A=pfss((10/(s^3+7*s^2+10*s+10)));
+d=denom(A(1));
+b=coeff(denom(A(1)))
+printf("for oscillatory roots:")
+Wn=sqrt(b(1,1));//natural_frequency
+//2*zeta*Wn=1.5;
+zeta=1.5/(2*Wn);//damping ratio
+Mp=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+disp(Wn,"natural_frequency,Wn=");
+disp(zeta,"damping ratio,zeta=");
+disp(Mp,"%_peak_overshoot,Mp=");
\ No newline at end of file diff --git a/29/CH11/EX11.5/exa11_6.sce b/29/CH11/EX11.5/exa11_6.sce new file mode 100755 index 000000000..63e92b1d5 --- /dev/null +++ b/29/CH11/EX11.5/exa11_6.sce @@ -0,0 +1,22 @@ +//Caption:time_response_for_unit_step_function
+//example 11_6
+//page 474
+s=%s;
+syms t;
+G=(s+2)/(s*(s+1))
+H=1;
+CL=G/.H
+disp(CL,"C(s)/R(s)=")
+y=ilaplace(CL,s,t);
+disp(y,"c(t)=");
+b=denom(CL)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+tr=(%pi-atan(sqrt(1-zeta^2)/zeta))/(Wn*sqrt(1-zeta^2))
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+disp(tr,"rise time=");
+disp(Mp,"max. peak overshoot=");
\ No newline at end of file diff --git a/29/CH11/EX11.7/exa11_7.sce b/29/CH11/EX11.7/exa11_7.sce new file mode 100755 index 000000000..ee1900a1b --- /dev/null +++ b/29/CH11/EX11.7/exa11_7.sce @@ -0,0 +1,20 @@ +//Caption:time_response_for_unit_step_function
+//example 11_7
+//page 475
+s=%s;
+syms t;
+CL=(s+2)/(s^2+2*s+2)
+disp(CL,"C(s)/R(s)=")
+y=ilaplace(CL,s,t);
+disp(y,"c(t)=");
+b=denom(CL)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+Tp=%pi/Wd//peak time
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+disp(Tp,"peak time=");
+disp(Mp,"max. peak overshoot=")
\ No newline at end of file diff --git a/29/CH11/EX11.8/exa11_8.sce b/29/CH11/EX11.8/exa11_8.sce new file mode 100755 index 000000000..2bd7e7fef --- /dev/null +++ b/29/CH11/EX11.8/exa11_8.sce @@ -0,0 +1,28 @@ +//Caption:time_response_for_unit_step_function
+//example 11_8
+//page 476
+s=%s;
+syms t;
+G=(20)/((s+1)*(s+5))
+H=1;
+CL=G/.H
+disp(CL,"C(s)/R(s)=")
+y=ilaplace(CL,s,t);
+disp(y,"c(t)=");
+b=denom(CL)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+Tp=%pi/Wd//peak time
+t=(2*%pi)/(Wn*sqrt(1-zeta^2))//period of oscillation
+ts=4/(zeta*Wn)//settling time
+N=Wd/(2*%pi)*ts//no. of oscillations completed before reaching steady state
+disp(Tp,"peak time=");
+disp(Mp,"max. peak overshoot=");
+disp(t,"period of oscillation");
+disp(N,"no. of oscillations completed before reaching steady state=");
+disp(ts,"settling time=")
diff --git a/29/CH11/EX11.9/exa11_9.sce b/29/CH11/EX11.9/exa11_9.sce new file mode 100755 index 000000000..bb18bf5f5 --- /dev/null +++ b/29/CH11/EX11.9/exa11_9.sce @@ -0,0 +1,20 @@ +//Caption:time_response_for_unit_step_function
+//example 11_9
+//page 476
+s=%s;
+syms t;
+CL=(4*s+4)/(s^2+2*s+5)
+disp(CL,"C(s)/R(s)=")
+y=ilaplace(CL,s,t);
+disp(y,"c(t)=");
+b=denom(CL)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+Tp=%pi/Wd//peak time
+disp(Tp,"peak time=");
+disp(Mp,"max. peak overshoot=");
\ No newline at end of file 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=") + diff --git a/29/CH2/EX2.4.1/exa2_4_1.jpg b/29/CH2/EX2.4.1/exa2_4_1.jpg Binary files differnew file mode 100755 index 000000000..e90a3bd53 --- /dev/null +++ b/29/CH2/EX2.4.1/exa2_4_1.jpg diff --git a/29/CH2/EX2.4.1/exa2_4_1.sce b/29/CH2/EX2.4.1/exa2_4_1.sce new file mode 100755 index 000000000..55a40d8b8 --- /dev/null +++ b/29/CH2/EX2.4.1/exa2_4_1.sce @@ -0,0 +1,13 @@ +//Caption:pole_zero_Plot
+// example 2.4.1
+//page 19
+//transfer function:G(s)=(1/2((s^2+4)*(1+2.5*s))/((s^2+2)*(1+0.5*s)))
+s=%s;
+G=syslin('c',(1/2*((s^2+4)*(1+2.5*s))/((s^2+2)*(1+0.5*s))));
+disp(G,"G(s)=");
+x=plzr(G)
+xtitle('pole-zero_configuration','Real_part','Img_part');
+// value at s=2
+a=2;
+g=(1/2*((a^2+4)*(1+2.5*a))/((a^2+2)*(1+0.5*a)));
+disp(g,"G(2)=");
diff --git a/29/CH2/EX2.4.2/exa2_4_2.sce b/29/CH2/EX2.4.2/exa2_4_2.sce new file mode 100755 index 000000000..f0421027c --- /dev/null +++ b/29/CH2/EX2.4.2/exa2_4_2.sce @@ -0,0 +1,16 @@ +//Caption:final_value
+// example 2.4.2
+//page 20
+//refer to fig.2.4.2 given on page 20
+//poles are located at s=0,-2 and -4
+//zero at s=-3
+s=%s;
+syms K;
+g=syslin('c',((s+3))/(s*(s+2)*(s+4)));//transfer function
+G=K*g;//transfer function
+disp(G,"G(s)=");
+//G(s)=3.2 at s=1;
+//on solving we find K=12
+K=12;
+G=K*g;
+disp(G,"G(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.1/exa3_2_1.sce b/29/CH3/EX3.2.1/exa3_2_1.sce new file mode 100755 index 000000000..baeed04b3 --- /dev/null +++ b/29/CH3/EX3.2.1/exa3_2_1.sce @@ -0,0 +1,18 @@ +//Caption:transfer_function
+// example 3.2.1
+//page 32
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1;
+// shifting take off point after block G2 to a position before block G2
+a= G2*H1;
+b=parallel(G2,G3);
+//shifting take off point before (G2+G3) to After (G2+G3)
+c=a/b;
+m=1;
+d=b/(1+m*b);
+e=series(G1,d);
+y=(e/(1+c*e));
+y=simple (y);
+disp (y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH3/EX3.2.10/exa3_2_10.sce b/29/CH3/EX3.2.10/exa3_2_10.sce new file mode 100755 index 000000000..77880b5ed --- /dev/null +++ b/29/CH3/EX3.2.10/exa3_2_10.sce @@ -0,0 +1,21 @@ +//Caption:transfer_function
+// example 3.2.10
+//page 43
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 G5 H1 H2 H3;
+a=parallel(G3,G4);
+//shift off the take off point before block 'a' to after block 'a'
+b=1/a;
+d=1;
+c=G2/(1+G2*d);
+e=parallel(H1,b);
+f=series(c,a);
+g=series(H2,e);
+h=f/(1+f*g);
+h=simple(h);
+i=series(h,G1);
+y=i/(1+i*H3);
+y=simple(y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.11/exa3_2_11.sce b/29/CH3/EX3.2.11/exa3_2_11.sce new file mode 100755 index 000000000..da2e42991 --- /dev/null +++ b/29/CH3/EX3.2.11/exa3_2_11.sce @@ -0,0 +1,22 @@ +//Caption:transfer_function
+// example 3.2.11
+//page 45
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 H1 H2 H3;
+a=G4/.H1;
+//shift the summing point after block G3 towards left of block G3
+b=G2/G3;
+c=series(a,G3);
+d=c/(1+c*H2);
+d=simple(d)
+//shift the summing point before block G1 towards right of block G1
+e=G1*H3;
+f=d/(1+d*e);
+f=simple(f)
+g=parallel(G1,b);
+g=simple(g);
+y=series(g,f)
+y=simple (y);
+disp(y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH3/EX3.2.12/exa3_2_12.sce b/29/CH3/EX3.2.12/exa3_2_12.sce new file mode 100755 index 000000000..3967e3760 --- /dev/null +++ b/29/CH3/EX3.2.12/exa3_2_12.sce @@ -0,0 +1,26 @@ +//Caption:transfer_function
+// example 3.2.12
+//page 47
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 H1 H2 H3;
+//shift the summing point before block G1 towards right of block G1
+//shift the summing point after block G3 towards left of block G3
+a=G2/G1
+b=H3/G3;
+c=G1/.H1
+d=G3/.H2
+e=series(G4,d)
+//shift the summing point after block e towards left of block e
+g=1/e
+f=series(a,g);
+f=simple(f)
+h=parallel(f,1);
+h=simple(h)
+i=e/(1+e*b);
+i=simple(i)
+j=series(c,h);
+y=series(j,i);
+y=simple (y);
+disp(y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH3/EX3.2.13/exa3_2_13.sce b/29/CH3/EX3.2.13/exa3_2_13.sce new file mode 100755 index 000000000..44d3dabb3 --- /dev/null +++ b/29/CH3/EX3.2.13/exa3_2_13.sce @@ -0,0 +1,21 @@ +//Caption:transfer_function
+// example 3.2.13
+//page 49
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 H1 H2;
+//shift the summing point after block H2 towards right of block H2
+//shift the summing point after block H1 towards right of block H2
+a=H1*H2
+b=parallel(G1,G2)
+c=G4/.a
+d=series(G3,c)
+e=d/(1+d*H2);
+e=simple(e)
+f=series(b,e)
+y=f/(1+f*a);
+y=simple (y);
+disp(y,"C(s)/R(s)=");
+
+
diff --git a/29/CH3/EX3.2.14/exa3_2_14.sce b/29/CH3/EX3.2.14/exa3_2_14.sce new file mode 100755 index 000000000..7844055dd --- /dev/null +++ b/29/CH3/EX3.2.14/exa3_2_14.sce @@ -0,0 +1,24 @@ +//Caption:transfer_function
+// example 3.2.14
+//page 50
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 H1 H2 R D;
+a=parallel(G1,G2)
+b=G3/.H2
+c=series(a,b)
+//inorder to determine C(s)/R(s) consider D=0
+d=series(c,G4);
+y=d/(1+d*H1);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
+// now consider R=0 for calculating C(s)/D(s)
+e=series(c,H1)
+z=G4/(1+G4*e);
+z=simple(z);
+disp(z,"C(s)/D(s)=");
+x=(y*R)+(z*D);
+x=simple(x);
+printf("total output");
+disp(x,"C(s)")
\ No newline at end of file diff --git a/29/CH3/EX3.2.15/exa3_2_15.sce b/29/CH3/EX3.2.15/exa3_2_15.sce new file mode 100755 index 000000000..24aab86a0 --- /dev/null +++ b/29/CH3/EX3.2.15/exa3_2_15.sce @@ -0,0 +1,29 @@ +//Caption:transfer_function
+// example 3.2.15
+//page 52
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 H1 H2 H3 D1 D2 R;
+a=G2/.H2
+b=a/(1+a*H3);
+b=simple(b)
+//inorder to determine C(s)/R(s) consider D1=0,D2=0
+c=series(b,G1)
+y=c/(1+c*H1);
+y=simple(y)
+disp(y,"C(s)/R(s)");
+// now consider R=0,D2=0 for calculating C(s)/D1(s)
+d=series(G1,H1);
+z=b/(1+b*d);
+z=simple(z)
+disp(z,"D1(s)/R(s)");
+// now consider R=0,D1=0 for calculating C(s)/D2(s)
+e=G1*(-H1);
+f=series(b,e);
+x=f/(1+f);
+x=simple(x);
+disp(x,"D2(s)/R(s)");
+out=(y*R)+(z*D1)+(x*D2);
+out=simple(out);
+disp(out,"C(s)");
\ No newline at end of file diff --git a/29/CH3/EX3.2.2/exa3_2_2.sce b/29/CH3/EX3.2.2/exa3_2_2.sce new file mode 100755 index 000000000..3b816f6db --- /dev/null +++ b/29/CH3/EX3.2.2/exa3_2_2.sce @@ -0,0 +1,14 @@ +//Caption:transfer_function
+// example 3.2.2
+//page 34
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1;
+// shifting take off point before block G1 to a position after block G1
+a=G1*H1;
+b=parallel(G1,G2);
+c=G3/.a
+y=series(b,c);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.3/exa3_2_3.sce b/29/CH3/EX3.2.3/exa3_2_3.sce new file mode 100755 index 000000000..2f5e487bb --- /dev/null +++ b/29/CH3/EX3.2.3/exa3_2_3.sce @@ -0,0 +1,18 @@ +//Caption:transfer_function
+// example 3.2.3
+//page 35
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 G5 G6 H1 H2;
+//shift the takeof point placed before G2 towards right side of block G2
+a= G5/G2;
+b=parallel(G3,G4);
+c=series(b,G6);
+d=parallel(a,c);
+e=series(G1,G2);
+l=series(H1,d);
+g=e/.H2
+y=g/(1+g*l)
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.4/exa3_2_4.sce b/29/CH3/EX3.2.4/exa3_2_4.sce new file mode 100755 index 000000000..7713c5521 --- /dev/null +++ b/29/CH3/EX3.2.4/exa3_2_4.sce @@ -0,0 +1,18 @@ +//Caption:transfer_function
+// example 3.2.4
+//page 36
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1 H2;
+//shift the take off point placed before G1 to after block G1
+a=G3/G1;
+b=parallel(a,G2);
+//shift the take off point before block b towards right side of same block
+c=1/b;
+d=series(H1,c);
+e=series(G1,b);
+g=parallel(H2,d);
+y=e/(1+e*g);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.5/exa3_2_5.sce b/29/CH3/EX3.2.5/exa3_2_5.sce new file mode 100755 index 000000000..07cfaf8f1 --- /dev/null +++ b/29/CH3/EX3.2.5/exa3_2_5.sce @@ -0,0 +1,18 @@ +//Caption:transfer_function
+// example 3.2.5
+//page 37
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1 H2 H3;
+//shift the take off point placed before G3 to after block G3
+a=H3/G3;
+b=G3/.H2;
+c=series(G2,b);
+//shift the summing point after block G1 to before block G1
+d=a/G1;
+e=G1/.H1;
+f=series(e,c);
+y=f/(1+f*d);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.6/exa3_2_6.sce b/29/CH3/EX3.2.6/exa3_2_6.sce new file mode 100755 index 000000000..67e3eecaf --- /dev/null +++ b/29/CH3/EX3.2.6/exa3_2_6.sce @@ -0,0 +1,12 @@ +//Caption:transfer_function
+// example 3.2.6
+//page 38
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1;
+a=parallel(G1,G3);
+b=G2/.H1;
+y=series(a,b);
+y=simple (y);
+disp(y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH3/EX3.2.7/exa3_2_7.sce b/29/CH3/EX3.2.7/exa3_2_7.sce new file mode 100755 index 000000000..3a0a45c95 --- /dev/null +++ b/29/CH3/EX3.2.7/exa3_2_7.sce @@ -0,0 +1,21 @@ +//Caption:transfer_function
+// example 3.2.7
+//page 39
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 H1 H2;
+//shift the take off point placed before G2 to after block G2
+a=G2*H1;
+//shift the take off point placed before G2 to after block G1 and shift the summing point before block G2 to before block G2
+//interchange consecutive summing point and shift the take off point placed before H2 to after block H2
+b=G2*H2;
+c=b*H1;
+d=parallel(G3,G2);
+e=1/.b
+f=series(d,e);
+g=G1/.a
+h=series(g,f);
+y=h/(1-h*c);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH3/EX3.2.8/exa3_2_8.sce b/29/CH3/EX3.2.8/exa3_2_8.sce new file mode 100755 index 000000000..150325619 --- /dev/null +++ b/29/CH3/EX3.2.8/exa3_2_8.sce @@ -0,0 +1,18 @@ +//Caption:transfer_function
+// example 3.2.8
+//page 41
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 G5 H1 H2;
+//shift the summing point before block G5 towards left of block G5
+a=G2*G5;
+b=G4/.H1;
+c=series(G5,H2);
+d=series(b,G3);
+e=d/(1+d*c);
+e=simple(e)
+f=parallel(G1,a);
+y=series(f,e);
+y=simple (y);
+disp(y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH3/EX3.2.9/exa3_2_9.sce b/29/CH3/EX3.2.9/exa3_2_9.sce new file mode 100755 index 000000000..94f8d01f5 --- /dev/null +++ b/29/CH3/EX3.2.9/exa3_2_9.sce @@ -0,0 +1,20 @@ +//Caption:transfer_function
+// example 3.2.9
+//page 42
+// we have defined parallel and series function which we are going to use here
+//exec parallel.sce;
+//exec series.sce;
+syms G1 G2 G3 G4 G5 H1 H2 H3;
+//shift the take off point placed before G3 to after block G3
+a=G5/G3;
+b=G1/.H1;
+c=series(b,G2);
+d=G3/.H2;
+e=parallel(G4,a);
+e=simple(e);
+f=series(c,d);
+g=series(f,e);
+g=simple(g);
+y=g/(1+g*H3);
+y=simple(y);
+disp (y,"C(s)/R(s)=");
\ No newline at end of file diff --git a/29/CH4/EX4.3.1/exa4_3_1.sce b/29/CH4/EX4.3.1/exa4_3_1.sce new file mode 100755 index 000000000..48b482254 --- /dev/null +++ b/29/CH4/EX4.3.1/exa4_3_1.sce @@ -0,0 +1,16 @@ +//Caption:overall_transmittance
+// example 4.3.1
+//page 63
+syms G1 G2 H1;
+// 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
+L1=-G1*H1;
+L2=-G2*H1;
+P1=G1;
+P2=G2;
+D1=1;
+D2=1;
+D=1-(L1+L2);
+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/CH4/EX4.3.2/exa4_3_2.sce b/29/CH4/EX4.3.2/exa4_3_2.sce new file mode 100755 index 000000000..f91e006b1 --- /dev/null +++ b/29/CH4/EX4.3.2/exa4_3_2.sce @@ -0,0 +1,15 @@ +//Caption:overall_transmittance
+// example 4.3.2
+//page 64
+syms G1 G2 H1;
+// 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;
+L1=-G1*H1;
+D1=1;
+D2=1;
+D=1-(L1);
+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/CH4/EX4.4.1/exa4_4_1.sce b/29/CH4/EX4.4.1/exa4_4_1.sce new file mode 100755 index 000000000..6481abeea --- /dev/null +++ b/29/CH4/EX4.4.1/exa4_4_1.sce @@ -0,0 +1,15 @@ +//Caption:closed_loop_transfer_function
+// example 4.4.1
+//page 64
+syms G1 G2 G3 H1;
+// 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*G3;
+P2=G2*G3;
+L1=-G3*H1;
+D1=1;
+D2=1;
+D=1-(L1);
+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/CH4/EX4.4.10/exa4_4_10.sce b/29/CH4/EX4.4.10/exa4_4_10.sce new file mode 100755 index 000000000..cde9b6fe2 --- /dev/null +++ b/29/CH4/EX4.4.10/exa4_4_10.sce @@ -0,0 +1,17 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.10
+//page 72
+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*G2*G3*G4;
+P2=G1*G5*G4;
+L1=-G2*H1;
+L2=-G3*H2;
+D1=1;
+D2=1;
+D=1-(L1+L2);
+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/CH4/EX4.4.2/exa4_4_2.sce b/29/CH4/EX4.4.2/exa4_4_2.sce new file mode 100755 index 000000000..aa85ac943 --- /dev/null +++ b/29/CH4/EX4.4.2/exa4_4_2.sce @@ -0,0 +1,22 @@ +//Caption:overall_gain
+// example 4.4.2
+//page 65
+syms a b c d e f 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=a*b*c*d;
+P2=a*g;
+L1=f;
+L2=c*e;
+L3=d*h;
+//nontouching loops are L1L2, L1L3
+L1L2=L1*L2;
+L1L3=L1*L3;
+D1=1;
+D2=1-L2;
+D=1-(L1+L2+L3)+(L1L2+L1L3);
+D=simple(D);
+Y=(P1*D1+P2*D2)/D;
+Y=simple(Y);
+disp(Y,"x5/x1");
\ No newline at end of file diff --git a/29/CH4/EX4.4.3/exa4_4_3.sce b/29/CH4/EX4.4.3/exa4_4_3.sce new file mode 100755 index 000000000..85f07f407 --- /dev/null +++ b/29/CH4/EX4.4.3/exa4_4_3.sce @@ -0,0 +1,27 @@ +//Caption:to_find_various_signal_flow_graph_parameter
+// example 4.4.3
+//page 66
+syms a b c d e f g h ij
+// 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
+//six independent path
+P1=a*b*d
+P2=e*f*h
+P3=a*j*h
+P4=e*i*d
+P5=-e*i*c*j*h
+P6=-a*j*g*i*d
+//3 INDIVIDUAL LOOPS
+L1=-b*c
+L2=-f*g
+L3=-i*c*j*g
+//NON TOUCHING LOOPS
+L1L2=L1*L2
+//PATH FACTORS
+D3=1;D4=1;D5=1;D6=1
+D1=1-L2
+D2=1-L1
+//GRAPH DETERMINANT
+D=1-(L1+L2+L3)+(L1L2);
+D=simple(D)
+disp(D,"graph_determinant=")
\ No newline at end of file diff --git a/29/CH4/EX4.4.4/exa4_4_4.sce b/29/CH4/EX4.4.4/exa4_4_4.sce new file mode 100755 index 000000000..524afe6ab --- /dev/null +++ b/29/CH4/EX4.4.4/exa4_4_4.sce @@ -0,0 +1,17 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.4
+//page 67
+syms G1 G2 G3 H1;
+// 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*G2*1;
+P2=G1*G3;
+L1=G2*(-1);
+L2=G3*(-1);
+L3=-G1*G2*H1
+D1=1;
+D2=1;
+D=1-(L1+L2+L3);
+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/CH4/EX4.4.5/exa4_4_5.sce b/29/CH4/EX4.4.5/exa4_4_5.sce new file mode 100755 index 000000000..a09d1eb6c --- /dev/null +++ b/29/CH4/EX4.4.5/exa4_4_5.sce @@ -0,0 +1,19 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.5
+//page 68
+syms G1 G2 G3 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*G2;
+P2=G1*G3;
+L1=-G2*H2;
+L2=-G1*G2*H1;
+L3=G1*G3*(-H2)*G2*(-H1);
+L3=simple(L3)
+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/CH4/EX4.4.6/exa4_4_6.sce b/29/CH4/EX4.4.6/exa4_4_6.sce new file mode 100755 index 000000000..3d1550577 --- /dev/null +++ b/29/CH4/EX4.4.6/exa4_4_6.sce @@ -0,0 +1,19 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.6
+//page 69
+syms G1 G2 G3 G4 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
+// to find C/R consider D=0
+P1=G1*G3*G4;
+P2=G2*G3*G4;
+L1=-G3*H1;
+L2=-G1*G3*G4*H2;
+L3=-G2*G3*G4*H2;
+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/CH4/EX4.4.7/exa4_4_7.sce b/29/CH4/EX4.4.7/exa4_4_7.sce new file mode 100755 index 000000000..36f263c39 --- /dev/null +++ b/29/CH4/EX4.4.7/exa4_4_7.sce @@ -0,0 +1,22 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.7
+//page 70
+syms G1 G2 G3 H1;
+// 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*G3*G4;
+P2=G1*(-G2);
+L1=G3*G4*(-1);
+L2=G1*G3*H1*(-1);
+L3=G1*G3*H1*(-1);
+L4=G1*(-G2)*(-1)*G3*H1*(-1);
+L5=G1*(-G2)*(-1)*G3*H1*(-1);
+L4=simple(L4);
+L5=simple(L5);
+D1=1;
+D2=1;
+D=1-(L1+L2+L3+L4+L5);
+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/CH4/EX4.4.8/exa4_4_8.sce b/29/CH4/EX4.4.8/exa4_4_8.sce new file mode 100755 index 000000000..6ac7adc1d --- /dev/null +++ b/29/CH4/EX4.4.8/exa4_4_8.sce @@ -0,0 +1,20 @@ +//Caption:transfer_function_using_mason's_gain_formula
+// example 4.4.8
+//page 70
+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*G2*G4;
+P2=G2*G3*G5;
+P3=G3;
+L1=-G4*H1;
+L2=-G2*G4*H2;
+L3=-G2*G5*H2;
+D1=1;
+D2=1;
+D3=1-L1;
+D=1-(L1+L2+L3);
+D=simple(D)
+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/CH4/EX4.4.9/exa4_4_9.sce b/29/CH4/EX4.4.9/exa4_4_9.sce new file mode 100755 index 000000000..abff33491 --- /dev/null +++ b/29/CH4/EX4.4.9/exa4_4_9.sce @@ -0,0 +1,18 @@ +//Caption:overall_transfer_function
+// example 4.4.9
+//page 71
+// we have defined parallel and series function which we are going to use here
+exec parallel.sce;
+exec series.sce;
+syms G1 G2 G3 G4 H5 H1 H2;
+//shift the SUMMING point locsted after G3 towards left of block G3
+a=G2/.H1;
+b=G5/G3;
+c=parallel(a,b);
+c=simple(c);
+d=G3/.H2;
+e=series(G1,c);
+f=series(e,d);
+y=series(G4,f);
+y=simple (y);
+disp(y,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH5/EX5.9.10/exa5_9_10.sce b/29/CH5/EX5.9.10/exa5_9_10.sce new file mode 100755 index 000000000..db28bc96a --- /dev/null +++ b/29/CH5/EX5.9.10/exa5_9_10.sce @@ -0,0 +1,17 @@ +//Caption:overall_transfer_function_of_given_system
+//example 5.9.10
+//page 108
+syms Ra Kt Jm fm Kb
+//where Ra=armature_resistance; Kt=motor_torque_const; Jm=moment_of_inertia; fm=coeff_of_viscous_friction; Kb=motor_back_emf_const
+s=%s;
+a=Kt/(s*Ra*(s*Jm+fm));
+a=simple(a);
+b=s*Kb;
+c=a/(1+a*b);
+c=simple(c);
+disp(c,"Q(s)/V(s)=");//overall_transfer_function
+Kt=0.183;Kb=0.183;Ra=4.8;Jm=.004;fm=0.0015;
+a=Kt/(s*Ra*(s*Jm+fm));
+b=s*Kb;
+c=a/(1+a*b);
+disp(c,"Q(s)/V(s)=");//overall_transfer_function_after substituting value in above equation
\ No newline at end of file diff --git a/29/CH5/EX5.9.11/exa5_9_11.sce b/29/CH5/EX5.9.11/exa5_9_11.sce new file mode 100755 index 000000000..ef5d15ab5 --- /dev/null +++ b/29/CH5/EX5.9.11/exa5_9_11.sce @@ -0,0 +1,15 @@ +//Caption:overall_transfer_function_of_positional_control_system
+//example 5.9.11
+//page 109
+syms Ka Ke Kb Kt Jeq feq Ra N1 N2
+//where Ka=amplifier_gain; Ke=error_detector_gain; Kb=motor_back_emf_const; Kt=motor_torque_const; Ra=armature_resistance; Jeq=moment_of_inertia; feq=coeff_of_viscous_friction;
+s=%s;
+Kt=.0001;Ra=0.2;Jeq=.0001;feq=.0005;Ka=10;Ke=2;Kb=0.0001;f=0.1;
+a=(Ka*Ke); // in series
+b=Kt/(s*Ra*(Jeq*s+feq));
+c=b/(1+b*s*Kb);
+d=(a*c); // in series
+f=0.1;
+g=(d*f); // in series
+h=g/(1+g);
+disp(h,"C(s)/R(s)=");//overall_transfer_function_after substituting value in above equation
diff --git a/29/CH5/EX5.9.12/exa5_9_12.sce b/29/CH5/EX5.9.12/exa5_9_12.sce new file mode 100755 index 000000000..9ad9ed617 --- /dev/null +++ b/29/CH5/EX5.9.12/exa5_9_12.sce @@ -0,0 +1,16 @@ +//Caption:overall_transfer_function_of_given_system
+//example 5.9.12
+//page 111
+syms Ka Ke Kf Rf Lf Jeq feq N1 N2
+//where Ka=amplifier_gain; Ke=error_detector_gain; Kf=motor_torque_const; Rf=field_resistance; Lf=field_inductance Jeq=moment_of_inertia; feq=coeff_of_viscous_friction;
+s=%s;
+d=N1/N2;
+Ka=10; Ke=8; Kf=0.05; Rf=5; Lf=0.25; Jeq=0.05; feq=0.075; d=0.1;
+a=(Ka*Ke);
+b=Kf/(Rf+s*Lf);
+c=1/(s*(Jeq*s+feq));
+g=(b*c) //in series
+h=(g*a) //in series
+i=(h*d) //in series
+j=i/(1+i);
+disp(j,"C(s)/R(s)=");
diff --git a/29/CH5/EX5.9.13/exa5_9_13.sce b/29/CH5/EX5.9.13/exa5_9_13.sce new file mode 100755 index 000000000..d71d7c31d --- /dev/null +++ b/29/CH5/EX5.9.13/exa5_9_13.sce @@ -0,0 +1,15 @@ +//Caption:overall_transfer_function_of_two_phase_ac_motor
+//example 5.9.13
+//page 113
+syms Ka K Ktg Jeq feq N1 N2 m
+//where Ka=amplifier_gain; Ktg=tachometer_gain_const Jeq=moment_of_inertia; feq=coeff_of_viscous_friction;
+s=%s;
+//from torque characterstics m and K are determined
+Ka=20; K=0.0012; Ktg=0.2; Jeq=0.00015; feq=0.0001;m=-0.0003;
+a=K/(Jeq*s+(feq-m));
+b=N1/N2;
+b=0.1;
+c=(Ka*a) // in series
+d=(c*b) // in series
+e=d/(1+Ktg*d);
+disp(e,"C(s)/R(s)=");//overall_transfer_function
diff --git a/29/CH5/EX5.9.14/exa5_9_14.sce b/29/CH5/EX5.9.14/exa5_9_14.sce new file mode 100755 index 000000000..cec2c4c89 --- /dev/null +++ b/29/CH5/EX5.9.14/exa5_9_14.sce @@ -0,0 +1,16 @@ +//Caption:transfer_function_of_motor
+//example 5.9.14
+//page 114
+syms Kt Kb Ra La J
+//where Ka=amplifier_gain; Kt=motor_torque_const; Ra=armature_resistance; La=armature_inductor; J=moment_of_inertia
+s=%s;
+//since there are two inputs Va(s)and Tl(s).If Va(s) is held at fixed value then only effect of Tl(s) is considered and Va(s)is taken as Zero.
+a=(Kt*Kb)/(Ra+s*La)
+b=1/J*s
+c=b/(1+b*a);
+disp(-c,"Wm(s)/Tl(s)=");//negative sign indicates that an increase in Tl decreases Wm
+Kb=9.55;Kt=9.55;Ra=0.75;La=0.005;J=50;
+a=(Kt*Kb)/(Ra+s*La)
+b=1/(J)*(1/(s))
+c=b/(1+b*a);
+disp(-c,"Wm(s)/Tl(s)=");//after putting values
\ No newline at end of file diff --git a/29/CH5/EX5.9.4/exa5_9_4.sce b/29/CH5/EX5.9.4/exa5_9_4.sce new file mode 100755 index 000000000..19dfe474f --- /dev/null +++ b/29/CH5/EX5.9.4/exa5_9_4.sce @@ -0,0 +1,14 @@ +//Caption:calculate_reference_voltage_Vr
+//example 5.9.4
+//page 102
+exec series.sce;
+A=2//amplifier
+K=10//motor_field
+N=100//speed
+tg=0.1//tacho_generator
+a=series(A,K);
+b=a/.tg;
+disp(b,"N/Vr=");
+//since N=100
+Vr=N*(1/b);
+disp(Vr,"reference_voltage=");
diff --git a/29/CH5/EX5.9.5/exa5_9_5.sce b/29/CH5/EX5.9.5/exa5_9_5.sce new file mode 100755 index 000000000..72c3d35bd --- /dev/null +++ b/29/CH5/EX5.9.5/exa5_9_5.sce @@ -0,0 +1,18 @@ +//Caption:calculate_reference_voltage_Vr
+//example 5.9.5
+//page 102
+exec series.sce;
+Vt=250//output_voltage
+Rf=100//field_winding_resistance
+Kg=500//generator_constant
+A=2//amplifier
+Vf=0.4//fraction_of_output_voltage_compared_with_reference_voltage
+a=1/Rf;
+b=series(A,a);
+c=series(b,Kg);
+d=c/.Vf;
+disp(d,"Vt/Vr=");
+//since Vt=250
+Vr=Vt*(1/d);
+disp(Vr,"reference_voltage=");
+
diff --git a/29/CH5/EX5.9.6/exa5_9_6.sce b/29/CH5/EX5.9.6/exa5_9_6.sce new file mode 100755 index 000000000..501c1a61d --- /dev/null +++ b/29/CH5/EX5.9.6/exa5_9_6.sce @@ -0,0 +1,24 @@ +//Caption:calculate_gain_of_amplifier_Ka
+//example 5.9.6
+//page 103
+//steady state equations: Ei=Vt+Il*Ra and Vt=Il*Rl
+//where Vt=output_voltage, Rl=load_resistance, Ra=armature_resistance, Il=load_current,
+syms Rl Ra Ka Er e;
+Ei=450;
+If=1.5;//field current
+Kg=Ei/If;//generator_emf_constant
+Vt=400;
+//from stedy state eq. we get : Vt/Ei=Rl/(Rl+Ra)
+a=Rl/(Rl+Ra);
+a=Vt/Ei;
+c=(Kg*a);
+G=(Ka*c);
+H=0.1;
+//transfer function relating erroe 'e' and the reference voltage 'Er' is e/Er=1/(1+GH)
+b=e/Er;
+b=1/(1+G*H);
+e=Vt*H*.02 ;//since allowable error is 2%
+Er=(Vt*H)+e;
+//since e/Er=1/(1+G*H), on putting value of e,Er,G and H and solving we get
+Ka=1.89;
+disp(Ka,"gain_of_amplifier_Ka=");
\ No newline at end of file diff --git a/29/CH5/EX5.9.7/exa5_9_7.sce b/29/CH5/EX5.9.7/exa5_9_7.sce new file mode 100755 index 000000000..8fba364de --- /dev/null +++ b/29/CH5/EX5.9.7/exa5_9_7.sce @@ -0,0 +1,13 @@ +//Caption:transfer_function_of_generator
+//example 5.9.7
+//page 105
+syms E Vf Kg R L
+s=%s;
+//generator_field_constant_Kg=delta(e)/delta(If)
+Kg=50/2;
+L=2;//field_inductance
+R=200;//field_resistance
+//transfer function is given by : E/Vf=(Kg/R+s*L)
+a=Kg/(R+s*L);
+disp(a,"E(s)/Vf(s)=");
+
diff --git a/29/CH5/EX5.9.8/exa5_9_8.sce b/29/CH5/EX5.9.8/exa5_9_8.sce new file mode 100755 index 000000000..50f0055f1 --- /dev/null +++ b/29/CH5/EX5.9.8/exa5_9_8.sce @@ -0,0 +1,25 @@ +//Caption:overall_transfer_function_of_given_system
+//example 5.9.8
+//page 105
+syms Rf Ra Kb Jm Lf La Kg Kt Jl s
+Rf=1000;//field_resistance
+Lf=100;//field_inductanc
+Kg=1000;//generator_field_constant
+Ra=20;//armature_resistance
+La=0.1;//armature_inductance
+Kt=1.2;//motor_torque_const
+Kb=1.2;//motor_back_emf_const
+Jl=0.00003;//moment_of_inertia
+Jm=0.00002;//coeff_of_viscous_friction
+a=Kt/(Ra+s*La);
+b=1/((Jm+Jl)*s);
+c=(a*b);
+d=c/(1+c*Kb);
+e=Kg/(Rf+s*Lf);
+f=(d*e);
+f=simple(f)
+disp(f,"wss(s)/Vf(s)=");
+
+//steady state value
+disp("under steady state condition, on putting s=0 in expression f,we get:")
+disp("Vf=1.2*wss")
\ No newline at end of file diff --git a/29/CH5/EX5.9.9/exa5_9_9.sce b/29/CH5/EX5.9.9/exa5_9_9.sce new file mode 100755 index 000000000..8d1983f3c --- /dev/null +++ b/29/CH5/EX5.9.9/exa5_9_9.sce @@ -0,0 +1,19 @@ +//Caption:overall_transfer_function_of_given_system
+//example 5.9.9
+//page 107
+syms Ka Ke Kt J f N1 N2
+s=%s;
+Ke=10;//error_detector_gain
+Ka=100;//amplifier_transconductance
+Kt=.0005;//motor_torque_const
+J=.0000125;//moment_of_inertia
+f=.0005;//coeff_of_viscous_friction
+g=N1/N2;
+g=1/20;
+a=(Ka*Ke);
+b=(a*Kt);
+c=1/(J*s^2+f*s);
+d=(c*b);
+e=(g*d);
+h=e/(1+e);
+disp(h,"C(s)/R(s)=");//result
\ No newline at end of file diff --git a/29/CH6/EX6.10.1/exa6_10_1.sce b/29/CH6/EX6.10.1/exa6_10_1.sce new file mode 100755 index 000000000..e1b05de90 --- /dev/null +++ b/29/CH6/EX6.10.1/exa6_10_1.sce @@ -0,0 +1,21 @@ +//Caption:time_response_for_step_function +//example 6.10.1 +//page 170 +// we have defined parallel and series function which we are going to use here +exec parallel.sce; +exec series.sce; +s=%s; +syms t; +a=4/(s*(s+4)) +b=s+1.2 +c=s+0.8 +d=a/(1+a) +e=parallel(b,c) +f=d/.e; +disp(f,"C(s)/R(s)=");//transfer function +//since input:r(t)=2, so R(s)=2/s;//step_function_of_magnitude_2 +g=f*(2/s); +disp(g,"C(s)="); +[A]=pfss(8/(s*(s+2)*(s+6))) +F=ilaplace((8/(s*(s+2)*(s+6))),s,t); +disp(F,"time_response_for_step_function_of_magnitude_2,f(t)=")
\ No newline at end of file diff --git a/29/CH6/EX6.10.10/exa6_10_10.sce b/29/CH6/EX6.10.10/exa6_10_10.sce new file mode 100755 index 000000000..27bf1d5f4 --- /dev/null +++ b/29/CH6/EX6.10.10/exa6_10_10.sce @@ -0,0 +1,48 @@ +//caption:determine_transfer_function,Wn,zeta
+//example 6.10.10
+//page 179
+//J=moment of inertia,f=C,Ke=error detector gain,Wn=natural frequency, zeta=damping ratio,Km=torque constant
+syms J f s
+Ke=5.73;
+Km=0.045;
+n=sym('N1/N2')
+n=subs(n,'N1/N2',1/10);
+J=0.25*float(n^2);//referred to motor side
+f=1*float(n^2);//referred to motor side
+//from the block diagram given in fig 6.10.6 on page 179,
+a=(Ke*Km)
+b=1/(J*s^2+f*s)
+c=(b*float(a))
+G=(n*c);
+G=simple(G)
+H=1;
+d=(1+G*H);
+d=simple(d);
+CL=G/d;
+CL=simple(CL)
+disp(CL,"C(s)/R(s)=");
+e=poly([328800 127516 31879],'s','coeff')
+printf("the characterstics eq. is:\n");
+disp(e);
+f=coeff(e)
+Wn=sqrt((f(1,1)/f(1,3)))//natural_frequency
+zeta=((f(1,2)/f(1,3))/(2*Wn))//damping ratio
+//part(b)
+syms Td
+g=1+s*Td
+h=(g*G)
+i=1+h*H
+i=simple(i);
+CL2=(h/i)
+CL2=simple(CL2);
+disp(CL2,"C(s)/R(s)=");
+poly(0,'s');
+l=s^2+(10.32*Td+4)*s+10.32;
+printf("on simplyfying the characterstics eq. is:");
+disp(float(l));
+Wn1=sqrt(10.32)//natural_frequency
+//2*zeta1*Wn1=10.32*Td+4
+zeta1=1;//as damping is critical
+Td=(2*zeta1*Wn1-4)/10.32;
+disp(Td,"time const. of advanced phase circuit,Td=");
+
diff --git a/29/CH6/EX6.10.11/exa6_10_11.sce b/29/CH6/EX6.10.11/exa6_10_11.sce new file mode 100755 index 000000000..d3c82c930 --- /dev/null +++ b/29/CH6/EX6.10.11/exa6_10_11.sce @@ -0,0 +1,32 @@ +//caption:determine_characterstics_eq_and_steady_state_error
+//example 6.10.11
+//page 181
+//J=moment of inertia,f=C,K=controller gain,Wn=natural frequency, zeta=damping ratio
+syms f J K Kt
+s=%s;
+A=sym((1/(J*s^2+f*s)));
+J=250;
+K=8*10^4;
+B=eval(A)
+a=(K*B);
+H1=s*Kt;
+b=(1+a*H1);
+b=simple(b);
+CL1=a/b;
+CL1=simple(CL1);
+H=1;
+c=1+CL1*H;
+c=simple(c);
+CL=CL1/c
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+Wn=sqrt(80000/250)//natural frequency
+//2*zeta*Wn=(80000*Kt+f)/250
+zeta=1;//for critical damping
+d=2*zeta*Wn;
+v=[320 d 1];
+CH=poly(v,'s','coeff');
+r=float(5*2*%pi/60);
+//steady state error for unit ramp input is:Ess= (2*zeta/Wn)
+Ess=(2*zeta/Wn)*r;
+disp(Ess,"steady_state_error=");
diff --git a/29/CH6/EX6.10.12/exa6_10_12.sce b/29/CH6/EX6.10.12/exa6_10_12.sce new file mode 100755 index 000000000..09fe8316d --- /dev/null +++ b/29/CH6/EX6.10.12/exa6_10_12.sce @@ -0,0 +1,43 @@ +//caption:determine_Wn,Wd,zeta_and_steady_state_error
+//example 6.10.12
+//page 182
+clc;
+s=%s;
+G=sym('25/(s*(s+5))');
+G=simple(G);
+H=1;
+CL=G/.H;
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+printf("the char. eq is:")
+disp("s^2+5*s+25")
+Wn=sqrt(25)//natural_frequency
+//2*zeta*Wn=5
+zeta=5/(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
+//steady state error for unit ramp input is:Ess= (2*zeta/Wn)
+Ess=(2*zeta/Wn);//steady state error
+disp("part(a):")
+disp(Wn,"natural_frequency,Wn=");
+disp(zeta,"damping ratio,zeta=");
+disp(Wd,"damped_frequency_of_oscillation,Wd=");
+disp(Mp,"%_max.peak_overshoot,Mp=");
+disp(Ess,"steady state error,Ess=");
+//if damping ratio is increased from 0.5 to 0.75 by incorporating tachometer feedback
+zeta=0.75;
+H1=sym('s*Kt')//tachometer_feedback
+CL1=G/(1+G*H1);
+CL1=simple(CL1);
+CL2=CL1/(1+H*CL1);
+CL2=simple(CL2);
+disp(CL2,"C(s)/R(s)=");
+Wn=sqrt(25);
+//2*zeta*Wn=25*Kt+5;
+Kt=(2*zeta*Wn-5)/25;//tachometer_gain
+Mp1=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+disp("After applying tachometer feedback:")
+disp(Kt,"tachometer_gain,Kt=");
+disp(Mp1,"%_peak_overshoot,Mp1=");
diff --git a/29/CH6/EX6.10.13/exa6_10_13.sce b/29/CH6/EX6.10.13/exa6_10_13.sce new file mode 100755 index 000000000..c6ceec01d --- /dev/null +++ b/29/CH6/EX6.10.13/exa6_10_13.sce @@ -0,0 +1,22 @@ +//caption:determine_K,ts,tp,Mp
+//example 6.10.13
+//page 184
+clc;
+syms K;
+s=%s;
+G=sym('K/(s*(s+6))');
+H=0.2;
+CL=G/(1+G*H);
+CL=simple(CL);
+Wn=sqrt(K/5)
+zeta=0.7//(given) damping ratio
+//2*zeta*Wn=6
+Wn=6/(2*zeta);
+K=Wn^2*5;
+ts=4/(zeta*Wn);//settling_time
+Mp=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+tp=%pi/(Wn*sqrt(1-zeta^2));//peak_time
+disp(Wn,"natural_frequency,Wn=");
+disp(Mp,"%_max.peak_overshoot,Mp=");
+disp(ts,"settling_time,ts=");
+disp(tp,"peak_time,tp=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.14/exa6_10_14.sce b/29/CH6/EX6.10.14/exa6_10_14.sce new file mode 100755 index 000000000..af24eb513 --- /dev/null +++ b/29/CH6/EX6.10.14/exa6_10_14.sce @@ -0,0 +1,31 @@ +//caption:determine_Mp,Ess_and_steady_state_value
+//example 6.10.14
+//page 185
+//there are two inputs: R(s) is reference input and Tl(s)is load torque
+clc;
+s=%s;
+A=sym('1/(0.15*s^2+0.9*s)');
+K=6;
+//while considering R(s),we take Tl(s)=0
+G=(A*K); //in series
+H=1;
+CL=G/(1+G*H);
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+Wn=sqrt(40);//natural_frequency
+//2*zeta*Wn=6
+zeta=6/(2*Wn);//damping ratio
+Mp=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+//steady state error for unit ramp input is:Ess= (2*zeta/Wn)
+Ess=(2*zeta/Wn);//steady state error
+disp(Mp,"%_peak_overshoot=");
+disp(Ess,"steady state error=");
+printf("Now considering effect of Tl(s),put R(s)=0\n");
+H=6;
+CL1=A/(1+A*H);
+CL1=simple(CL1);
+disp(CL1,"C(s)/-Tl(s)=");//-ve sign indicates output position lags behind the input
+Tl=1/s;//given
+C=-Tl*CL1;
+Css=limit(s*C,s,0);
+disp(Css,"steady state value of output=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.16/exa6_10_16.sce b/29/CH6/EX6.10.16/exa6_10_16.sce new file mode 100755 index 000000000..f30f80961 --- /dev/null +++ b/29/CH6/EX6.10.16/exa6_10_16.sce @@ -0,0 +1,25 @@ +//caption:determine_Wn,zeta_and_Mp
+//example 6.10.16
+//page 187
+s=%s;
+num=1;
+den=sym('s*(1+0.5*s)*(1+0.2*s)');
+c=num/den;
+c=simple(c);
+disp(c,"C(s)/E(s)=");
+G=c;
+H=1;
+CL=G/(1+G*H);
+CL=simple(CL);
+disp(CL,"C(s)/R(s)=");
+A=pfss((10/(s^3+7*s^2+10*s+10)));
+d=denom(A(1));
+b=coeff(denom(A(1)))
+printf("for oscillatory roots:")
+Wn=sqrt(b(1,1));//natural_frequency
+//2*zeta*Wn=1.5;
+zeta=1.5/(2*Wn);//damping ratio
+Mp=exp((-zeta*%pi)/sqrt(1-zeta^2))*100;//%_peak_overshoot
+disp(Wn,"natural_frequency=");
+disp(zeta,"damping ratio=");
+disp(Mp,"%_peak_overshoot=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.17/exa6_10_17.sce b/29/CH6/EX6.10.17/exa6_10_17.sce new file mode 100755 index 000000000..57e54f559 --- /dev/null +++ b/29/CH6/EX6.10.17/exa6_10_17.sce @@ -0,0 +1,30 @@ +//caption:determine_Kp_Kv_Ka
+//example 6.10.17
+//page 188
+s=%s;
+syms t;
+num=sym('2*(s^2+3*s+20)');
+den=sym('s*(s+2)*(s^2+4*s+10)');
+GH=num/den;
+GH=simple(GH);
+disp(GH,"G(s)H(s)=");
+input1=5;
+Kp=limit(GH,s,0);//static positional error coefficient
+Ess=5*(1/(1+Kp));//steady state error
+e=(1/(%inf+1));
+e=0;
+Ess=e;
+disp(Kp,"static positional error coefficient=");
+disp(Ess,"steady state error=");
+input2=4*t;
+Kv=limit(s*GH,s,0);//static velocity error coefficient
+Ess=(1/Kv)*4;//steady state error
+disp(Kv,"static velocity error coefficient=");
+disp(Ess,"steady state error=");
+input3=(4*t^2)/2;
+Ka=limit(s^2*GH,s,0);//static acceleration error coefficient
+Ess=(1/Ka)*4;//steady state error
+disp(Ka,"static acceleration error coefficient=");
+disp("steady state error=");
+disp("infinity")
+
diff --git a/29/CH6/EX6.10.18/exa6_10_18.sce b/29/CH6/EX6.10.18/exa6_10_18.sce new file mode 100755 index 000000000..58c65dc0c --- /dev/null +++ b/29/CH6/EX6.10.18/exa6_10_18.sce @@ -0,0 +1,28 @@ +//caption:determine_Kp_Kv_Ka
+//example 6.10.17
+//page 188
+s=%s;
+syms t K zeta Wn;
+num=K;
+den=sym('s*(s^2+2*zeta*Wn*s+Wn^2)');
+G=num/den;
+G=simple(G);
+disp(G,"G(s)=");
+Kp=limit(G,s,0);//static positional error coefficient
+disp(Kp,"static positional error coefficient,Kp=");
+Kv=limit(s*G,s,0);//static velocity error coefficient
+disp(Kv,"static velocity error coefficient,Kv=");
+Ka=limit(s^2*G,s,0);//static acceleration error coefficient
+disp(Ka,"static acceleration error coefficient,Ka=");
+printf("for(ii):");
+num=sym('100*(s+2)*(s+40)');
+den=sym('s^3*(s^2+4*s+200)');
+GH=num/den;
+GH=simple(GH);
+disp(GH,"G(s)H(s)=");
+Kp=limit(GH,s,0);//static positional error coefficient
+disp(Kp,"static positional error coefficient,Kp=");
+Kv=limit(s*GH,s,0);//static velocity error coefficient
+disp(Kv,"static velocity error coefficient,Kv=");
+Ka=limit(s^2*GH,s,0);//static acceleration error coefficient
+disp(Ka,"static acceleration error coefficient,Ka=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.19/exa6_10_19.sce b/29/CH6/EX6.10.19/exa6_10_19.sce new file mode 100755 index 000000000..ed7f4ad09 --- /dev/null +++ b/29/CH6/EX6.10.19/exa6_10_19.sce @@ -0,0 +1,24 @@ +//caption:determine_steady_state_error
+//example 6.10.19
+//page 189
+s=%s;
+syms K bta alpha G
+num=sym('K*s+bta');
+den=sym('s^2+alpha*s+bta');
+CL=num/den;
+disp(CL,"C(s)/R(s)=");//----(1)
+H=1;
+//also
+cl=G/(1+G*H);
+disp(cl,"also,C(s)/R(s)=");//------(2)
+//from eq. (1) and (2), we get
+G=num/(s^2+s*(alpha-K));
+disp(G,"G(s)=");
+B=1/(1+G);
+B=simple(B);
+disp(B,"E(s)/R(s)=");
+R=1/s^2;
+E=B*R;
+E=simple(E);
+Ess=limit(s*E,s,0);
+disp(Ess,"steady state error=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.2/exa6_10_2.sce b/29/CH6/EX6.10.2/exa6_10_2.sce new file mode 100755 index 000000000..0819482cb --- /dev/null +++ b/29/CH6/EX6.10.2/exa6_10_2.sce @@ -0,0 +1,22 @@ +//Caption:time_response_for_unit_impulse_and_step_function +//example 6.10.2 +//page 171 +//G(s)=(4*s+1)/4*(s^2);H(s)=1; +clc; +s=%s; +syms t; +G=(4*s+1)/(4*(s^2))//G(s) +b=1; +a=G/.(b); +disp(a,"C(s)/R(s)="); +//for unit impulse response R(s)=1 ; so C(s)=a; +disp("for unit impulse response R(s)=1 ; so C(s)=a;") +disp(a,"C(s)="); +c=ilaplace(a,s,t); +disp(c,"c(t)="); +//for unit step response R(s)=1/s +disp('for unit step response R(s)=1/s, so'); +d=a*(1/s); +disp(d,"C(s)="); +e=ilaplace(d,s,t); +disp(e,"c(t)=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.20/exa6_10_20.sce b/29/CH6/EX6.10.20/exa6_10_20.sce new file mode 100755 index 000000000..d2b18fd7f --- /dev/null +++ b/29/CH6/EX6.10.20/exa6_10_20.sce @@ -0,0 +1,27 @@ +//caption:determine_steady_state_error_and_error_coefficient
+//example 6.10.20
+//page 189
+s=%s;
+syms t a0 a1 a2;
+r=a0+a1*t+(a2/2)*t^2;
+//since for 'r' only upto 2nd order derivative is non zero, so only coeff. C0 C1 C2 exist
+num=20;
+den=sym('(s*(s+2))');
+G=num/den;
+disp(G,"G(s)=");
+A=1/(1+G);
+A=simple(A);
+disp(A,"E(s)/R(s)=");
+C0=limit(A,s,0);
+B=sym('((20)/(s^2+2*s+20))');//on simplyfying A=1-B
+d=diff(-B,s);
+C1=limit(d,s,0);
+d1=diff(-B,s,2);
+C2=limit(d1,s,0);
+r1=diff(r,t);
+r2=diff(r,t,2);
+e=(C0*r)+(C1*r1)+(C2*r2)/2;
+disp(C0,"C0=");
+disp(float(C1),"C1=");
+disp(float(C2),"C2=");
+disp(float(e),"steady_state_error,e=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.21/exa6_10_21.sce b/29/CH6/EX6.10.21/exa6_10_21.sce new file mode 100755 index 000000000..9d4a6c798 --- /dev/null +++ b/29/CH6/EX6.10.21/exa6_10_21.sce @@ -0,0 +1,27 @@ +//caption:determine_steady_state_error_and_error_coefficient
+//example 6.10.21
+//page 191
+s=%s;
+syms t;
+r=2+3*t+2*t^3;
+//since for 'r' only upto 2nd order derivative is non zero, so only coeff. C0 C1 C2 exist
+G=sym('1/(s*(s+2))');
+A=1/(1+G);
+A=simple(A);
+disp(A,"E(s)/R(s)=");
+C0=limit(A,s,0);
+B=sym('((1)/(s^2+2*s+1))');//on simplyfying A=1-B
+d=diff(-B,s);
+C1=limit(d,s,0);
+d1=diff(-B,s,2);
+C2=limit(d1,s,0);
+r1=diff(r,t);
+r2=diff(r,t,2);
+d2=diff(-B,s,3)
+C3=limit(d2,s,0)
+e=(C0*r)+(C1*r1)+(C2*r2)/2;
+disp(float(e),"steady_state_error,e=");
+disp(C0,"C0=");
+disp(float(C1),"C1=");
+disp(float(C2),"C2=");
+disp(float(C3),"C3=")
diff --git a/29/CH6/EX6.10.22/exa6_10_22.sce b/29/CH6/EX6.10.22/exa6_10_22.sce new file mode 100755 index 000000000..4eaf23e64 --- /dev/null +++ b/29/CH6/EX6.10.22/exa6_10_22.sce @@ -0,0 +1,34 @@ +//caption:determine_reference_voltage,Er_and_%change_in_terminal_voltage
+//example 6.10.22
+//page 191
+clc;
+syms G H
+s=%s;
+A=G/.H;
+disp(A,"E0/Er=");
+G=200; //gain
+H=0.1;
+B=eval(A);
+disp(B,"E0/Er=");
+E0=250;
+Er=(1/B)*E0;
+disp("for_closed_loop_system:");
+disp(float(Er),"reference_voltage,Er=");
+disp("for_open_loop_system:");
+disp(float(E0/G),"Er=E0/G=");
+
+disp("part (b)")
+disp("for closed loop system:")
+disp("as the forward path gain is reduced by 10%, the new value of gain,G is 180 ")
+G=180 //gain
+pcG=10 //percentage change in G
+S=1/(1+G*H)
+disp(S,"sensitivity,S=");
+disp("since S=1/19, (given)")
+pcM=S*pcG //percentage change in overall gain,M
+pcEo=pcM
+disp(pcM,"percentage change in overall gain,M=")
+disp(pcEo,"percentage change in terminal voltage,Eo=")
+disp("for open loop system:")
+pcEo=(25/250)*100
+disp(pcEo,"percentage change in terminal voltage,Eo=")
\ No newline at end of file diff --git a/29/CH6/EX6.10.23/exa6_10_23.sce b/29/CH6/EX6.10.23/exa6_10_23.sce new file mode 100755 index 000000000..2abaf3686 --- /dev/null +++ b/29/CH6/EX6.10.23/exa6_10_23.sce @@ -0,0 +1,24 @@ +//caption:determine_sensitivity_w.r.t_K_and_H +//example 6.10.23 +//page 192 +syms Wn zeta K H; +s=%s; +A=sym('Wn^2/(s^2+2*zeta*Wn*s)'); +B=(A*K); +CL=B/(1+B*H); +CL=simple(CL); +disp(CL,"overall_transfer_function:M(s)="); +disp("sensitivity_w.r.t_K:"); +a=diff(CL,K); +b=K/CL; +b=simple(b); +Sk=a*b; +Sk=simple(Sk); +disp(Sk,"sensitivity_w.r.t_K,Sk="); +disp("sensitivity_w.r.t_H:"); +c=diff(CL,H); +d=H/CL; +d=simple(d); +Sh=c*d; +Sh=simple(Sh); +disp(Sh,"sensitivity_w.r.t_H,Sh=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.3/exa6_10_3.sce b/29/CH6/EX6.10.3/exa6_10_3.sce new file mode 100755 index 000000000..6caa96234 --- /dev/null +++ b/29/CH6/EX6.10.3/exa6_10_3.sce @@ -0,0 +1,16 @@ +//Caption:time_response_for_unit_step_function
+//example 6.10.3
+//page 172
+//G(s)=2/(s*(s+3)
+clc;
+s=%s;
+syms t;
+G=2/(s*(s+3))//G(s)
+b=1;
+a=G/.(b);
+disp(a,"C(s)/R(s)=");
+disp('for unit step response R(s)=1/s');
+d=a*(1/s);
+disp(d,"C(s)=");
+e=ilaplace(d,s,t);
+disp(e,"c(t)=");
\ No newline at end of file diff --git a/29/CH6/EX6.10.4/exa6_10_4.sce b/29/CH6/EX6.10.4/exa6_10_4.sce new file mode 100755 index 000000000..3c76418cc --- /dev/null +++ b/29/CH6/EX6.10.4/exa6_10_4.sce @@ -0,0 +1,30 @@ +//Caption:time_response_for_unit_step_function
+//example 6.10.4
+//page 172
+s=%s;
+syms t;
+a=(s+4);
+b=1/(s*(s+2));
+c=(a*b); //in series
+d=0.5;
+e=c/.d
+f=1;
+g=e/.f;
+disp(g,"C(s)/R(s)=");
+disp('for unit step response R(s)=1/s, so');
+h=g*(1/s);
+disp(h,"C(s)=");
+[A]=pfss(h);
+A(1)=(1/s)
+F1=ilaplace(A(1),s,t)
+//A(2)can be written as: A(2)=a1+a2
+a1=-1/(4*(6+3.5*s+s^2));
+a2=(-(s+1.75)/(6+3.5*s+s^2));
+F2=ilaplace(a1,s,t);
+F3=ilaplace(a2,s,t);
+//now multiplying by their coefficient
+F1=(2/3)*F1;
+F2=(1/6)*F2;
+F3=(2/3)*F3;
+//after adding F1,F2 and F3 and simplyfying we get time response which is denoted by 'c(t)'
+disp('c(t)=((2-(%e^(-1.75*t)*(2*cos(1.71*t)-0.29*sin(1.71*t))))/3');//time_response
\ No newline at end of file diff --git a/29/CH6/EX6.10.5/exa6_10_5.sce b/29/CH6/EX6.10.5/exa6_10_5.sce new file mode 100755 index 000000000..34107206d --- /dev/null +++ b/29/CH6/EX6.10.5/exa6_10_5.sce @@ -0,0 +1,30 @@ +//Caption:calculate_Wn,zeta,Wd,tp,Mp
+//example 6.10.5
+//page 174
+//given G(s)=20/(s+1)*(s+2)
+clc;
+s=%s;
+G=syslin('c',[20/((s+1)*(s+5))])//G(s):transfer function in forward path
+H=1;//backward path transfer function
+a=G/.H //closed loop transfer function
+b=denom(a)
+c=coeff(b)
+//Wn^2=c(1,1)
+Wn=sqrt(c(1,1))//natural frequency
+disp(Wn,"natural frequency,Wn=")
+//2*zeta*Wn=c(1,2)
+zeta=c(1,2)/(2*Wn)//damping ratio
+disp(zeta,"damping ratio,zeta=")
+Wd=Wn*sqrt(1-zeta^2)//damped frequency
+disp(Wd,"damping ratio,Wd=")
+Tp=%pi/Wd//peak time
+disp(Tp,"peak time,Tp=")
+Mp=(exp(-(zeta*%pi)/sqrt(1-zeta^2)))*100//max. overshoot
+disp(Mp,"max overshoot,Mp=")
+t=(2*%pi)/(Wn*sqrt(1-zeta^2))//period of oscillation
+disp(t,'time at which first overshoot occurs=')
+disp(t,"period of oscillation,t=")
+ts=4/(zeta*Wn)//settling time
+disp(ts,"settling time,ts=")
+N=Wd/(2*%pi)*ts//no. of oscillations completed before reaching steady state
+disp(N,"no. of oscillations completed before reaching steady state,N=")
\ No newline at end of file diff --git a/29/CH6/EX6.10.6/exa6_10_6.sce b/29/CH6/EX6.10.6/exa6_10_6.sce new file mode 100755 index 000000000..484b82e84 --- /dev/null +++ b/29/CH6/EX6.10.6/exa6_10_6.sce @@ -0,0 +1,29 @@ +//Caption:time_response
+//example 6.10.6
+//page 174
+//Kt=torque constant,J=moment of inertia,f=coeff. of viscous friction
+clc;
+syms Kt J f t
+s=%s;
+Kt=360,J=10,f=60
+b=1/(J*s^2+f*s);
+G=(Kt*b) //in series
+H=1;//backward path transfer function
+cl=G/.H;//closed_loop_transfer_function
+d=denom(cl)/10;//taking 10 common from numerator and denominator for simplyfying closed_loop_transfer_function
+f=numer(cl)/10;
+CL=f/d;//closed_loop_transfer_function_after_simplifying
+printf("overall transfer function= \n");
+disp(CL,"C(s)/R(s)=");
+//given R(s)=(50*(%pi/180))*(1/s);
+R=(50*(%pi/180))*(1/s);
+C=R*CL;
+e=coeff(d)
+//Wn^2=e(1,1)
+Wn=sqrt(e(1,1))//natural frequency
+//2*zeta*Wn=c(1,2)
+zeta=e(1,2)/(2*Wn)//damping ratio
+//c(t):time_response_expression
+c=(5*%pi/18)*(1-(exp(-zeta*Wn*t)*sin(Wn*sqrt(1-zeta^2)*t+atan(sqrt(1-zeta^2)/zeta)))/sqrt(1-zeta^2));
+c=float(c)
+disp(c,"c(t)=")
\ No newline at end of file diff --git a/29/CH6/EX6.10.7/exa6_10_7.sce b/29/CH6/EX6.10.7/exa6_10_7.sce new file mode 100755 index 000000000..936412901 --- /dev/null +++ b/29/CH6/EX6.10.7/exa6_10_7.sce @@ -0,0 +1,33 @@ +//caption:determine_factor_by_which_K_should_be_reduced
+//example 6.10.7
+//page 175
+syms T K //K=forward_path_gain,T=time_constant
+s=%s;
+G=K/(s*(s*T+1));
+G=simple(G);
+printf("the_forward_path_transfer_function: \n" );
+disp(G,"G(s)=");
+H=1;//backward path transfer function
+CL=G/.H;
+CL=simple(CL);
+printf("the_overlall_transfer_function: \n" );
+disp(CL,"C(s)/R(s)=");
+printf("the_characterstic_equation_is:\n ");
+disp("s^2+s/T+K/T=0");
+//from char. eq. we get Wn^2=K/T and 2*zeta*Wn=1/T, so
+Wn=sqrt(K/T);//natural frequency
+zeta=(1/2)*sqrt(1/K*T)
+//let K1 be forward path gain when Mp1=60% and zeta1 be corresponding damping factor
+syms K1 K2 zeta1 zeta2
+Mp1=(exp(-(zeta1*%pi)/sqrt(1-zeta1^2)))*100//max. overshoot
+//on solving we get :
+zeta1=0.158
+//similarly let K2 be forward path gain when Mp2=20% and zeta2 be corresponding damping factor, which gives
+zeta2=0.447
+//assuming time const. T to be const. we get
+k=(K1/K2);
+k=(zeta1/zeta2)^2;
+disp(k,"K1/K2=");
+
+
+
diff --git a/29/CH6/EX6.10.8/exa6_10_8.sce b/29/CH6/EX6.10.8/exa6_10_8.sce new file mode 100755 index 000000000..f742fa99f --- /dev/null +++ b/29/CH6/EX6.10.8/exa6_10_8.sce @@ -0,0 +1,29 @@ +//caption:determine_steady_state_speed_and_error
+//example 6.10.8
+//page 176
+//Tm=torque constant,J=moment of inertia,f=coeff. of viscous friction, E=error detector gain
+syms Tm J f t E s
+Tm=75;J=10;f=5;E=1;
+a=(Tm*E);
+b=1/(J*s+f);
+c=(a*b);
+H=1;//backward path transfer function
+CL=c/.H;
+printf("the_overlall_transfer_function: \n" );
+disp(CL,"Wo(s)/Wr(s)=");
+//since Wr(s)=(2*%pi)*(1/s)
+q=bfloat((2*%pi),2)
+Wr=q*(1/s)
+Wo=CL*Wr;
+wo=ilaplace(Wo,s,t)
+printf("expression_relating_load_speed_and_time:\n");
+disp(wo,"wo(t)=");
+a=Wo*s
+Woss=limit(a,s,0);//steady state speed
+Woss=dbl(Woss);
+disp(Woss,"steady state speed=");
+We=Wr*(10*s+5)/(10*s+80);
+Wess=limit(s*We,s,0);//steady state error
+Wess=dbl(Wess);
+disp(Wess,"steady state error=");
+
diff --git a/29/CH6/EX6.10.9/exa6_10_9.sce b/29/CH6/EX6.10.9/exa6_10_9.sce new file mode 100755 index 000000000..19155fce5 --- /dev/null +++ b/29/CH6/EX6.10.9/exa6_10_9.sce @@ -0,0 +1,28 @@ +//caption:determine_J,f,K
+//example 6.10.9
+//page 178
+//J=moment of inertia,f=C,K=forward path gain,Wn=natural frequency, zeta=damping ratio
+syms J f K s zeta Wn
+CL=1/(J*s^2+f*s+K);
+printf("given:transfer function is:\n");
+disp(CL,"theta(s)/T(s)=");
+T=10*(1/s);
+theta=T*CL;
+theta_ss=limit(s*theta,s,0)//steady_state_value
+printf("given:theta_ss=0.5\n so K=10/0.5");
+theta_ss=0.5;
+K=10/theta_ss;
+disp(K,"forward path gain,K=");
+Mp=0.06;//max.peak overshoot (given)--------(1)
+Mp=exp((-zeta*%pi)/sqrt(1-zeta^2))//---------(2)
+//from eq. (1) and (2), we get
+zeta=0.66;
+tp=%pi/(Wn*(sqrt(1-zeta^2)));//-------(3)
+tp=1//(given)
+Wn=%pi/(tp*sqrt(1-zeta^2));
+//also Wn=sqrt(K/J);
+J=K/Wn^2;
+//also 2*zeta*Wn=f/J
+f=J*2*zeta*Wn;
+disp(J,"moment of inertia,J=");
+disp(f,"moment of inertia,f=");
\ No newline at end of file diff --git a/29/CH7/EX1.0/exa1.jpg b/29/CH7/EX1.0/exa1.jpg Binary files differnew file mode 100755 index 000000000..0513653a0 --- /dev/null +++ b/29/CH7/EX1.0/exa1.jpg diff --git a/29/CH7/EX1.0/exa1.sce b/29/CH7/EX1.0/exa1.sce new file mode 100755 index 000000000..3e970cbd0 --- /dev/null +++ b/29/CH7/EX1.0/exa1.sce @@ -0,0 +1,7 @@ +//caption:root_locus
+//example 1
+//page 291
+s=%s;
+g=s/(s+1);
+G=syslin('c',g)
+evans(g,200)
\ No newline at end of file diff --git a/29/CH7/EX2.0/exa2.jpg b/29/CH7/EX2.0/exa2.jpg Binary files differnew file mode 100755 index 000000000..7fcf6d381 --- /dev/null +++ b/29/CH7/EX2.0/exa2.jpg diff --git a/29/CH7/EX2.0/exa2.sce b/29/CH7/EX2.0/exa2.sce new file mode 100755 index 000000000..18f80e09f --- /dev/null +++ b/29/CH7/EX2.0/exa2.sce @@ -0,0 +1,7 @@ +//caption:root_locus
+//example 2
+//page 291
+s=%s;
+g=1/(s*(s+4));
+G=syslin('c',g)
+evans(g,200)
\ No newline at end of file diff --git a/29/CH7/EX3.0/exa3.jpg b/29/CH7/EX3.0/exa3.jpg Binary files differnew file mode 100755 index 000000000..aadfabafd --- /dev/null +++ b/29/CH7/EX3.0/exa3.jpg diff --git a/29/CH7/EX3.0/exa3.sce b/29/CH7/EX3.0/exa3.sce new file mode 100755 index 000000000..5498eefa2 --- /dev/null +++ b/29/CH7/EX3.0/exa3.sce @@ -0,0 +1,7 @@ +//caption:root_locus
+//example 3
+//page 292
+s=%s;
+g=1/(s*(s+1)*(s+3));
+G=syslin('c',g)
+evans(g,200)
\ No newline at end of file diff --git a/29/CH7/EX7.17.1/exa7_17_1.jpg b/29/CH7/EX7.17.1/exa7_17_1.jpg Binary files differnew file mode 100755 index 000000000..d03e674ba --- /dev/null +++ b/29/CH7/EX7.17.1/exa7_17_1.jpg diff --git a/29/CH7/EX7.17.1/exa7_17_1.sce b/29/CH7/EX7.17.1/exa7_17_1.sce new file mode 100755 index 000000000..6fe671d70 --- /dev/null +++ b/29/CH7/EX7.17.1/exa7_17_1.sce @@ -0,0 +1,22 @@ +//caption:stability_using_Nyquist_criterion +//example 7.17.1 +//page 236 +clf; +s=%s; +s1=-s; +g=50/((s+1)*(s+2)); +g1=50/((s1+1)*(s1+2)); +GH=syslin('c',g) +GH1=syslin('c',g1) +nyquist(GH); +nyquist(GH1); +mtlb_axis([-5 30 -20 20]); +xtitle('Nyquist plot of 50/((s+1)*(s+2))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is not encircled by Nyquist plot ,so N=0 and P=0(given)") +N=0;//no. of encirclement of -1+%i0 by G(s)H(s) plot +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/CH7/EX7.17.1/exa7_17_1_margin.jpg b/29/CH7/EX7.17.1/exa7_17_1_margin.jpg Binary files differnew file mode 100755 index 000000000..d6468a316 --- /dev/null +++ b/29/CH7/EX7.17.1/exa7_17_1_margin.jpg diff --git a/29/CH7/EX7.17.18/exa7_17_18.jpg b/29/CH7/EX7.17.18/exa7_17_18.jpg Binary files differnew file mode 100755 index 000000000..f1de29ab8 --- /dev/null +++ b/29/CH7/EX7.17.18/exa7_17_18.jpg diff --git a/29/CH7/EX7.17.18/exa7_17_18.sce b/29/CH7/EX7.17.18/exa7_17_18.sce new file mode 100755 index 000000000..e1e47b199 --- /dev/null +++ b/29/CH7/EX7.17.18/exa7_17_18.sce @@ -0,0 +1,14 @@ +//caption:gain_phase_plot
+//example 7.17.18
+//page 256
+k=1;
+s=%s;
+G=syslin('c',k/(s*(0.5*s+1)*(0.25*s+1)));
+// freq range to plot
+fmin=0.1;
+fmax=7;
+black(G, fmin, fmax)
+xgrid
+xtitle('Gain phase plot')
+disp("for GM=8 db, K=2.23")
+disp("for PM=20 deg. , K=2.69")
\ No newline at end of file diff --git a/29/CH7/EX7.17.2.i/exa7_17_2_i.jpg b/29/CH7/EX7.17.2.i/exa7_17_2_i.jpg Binary files differnew file mode 100755 index 000000000..7c82898e9 --- /dev/null +++ b/29/CH7/EX7.17.2.i/exa7_17_2_i.jpg diff --git a/29/CH7/EX7.17.2.i/exa7_17_2_i.sce b/29/CH7/EX7.17.2.i/exa7_17_2_i.sce new file mode 100755 index 000000000..064a86f72 --- /dev/null +++ b/29/CH7/EX7.17.2.i/exa7_17_2_i.sce @@ -0,0 +1,23 @@ +//caption:stability_using_Nyquist_criterion +//example 7.17.2 +//page 237 +clf(); +s=%s; +s1=-s; +disp("for K=1.25") +g=(1.25*(s+1))/((s+0.5)*(s-2)); +g1=(1.25*(s1+1))/((s1+0.5)*(s1-2)); +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 (10*(s-1))/((s+2)*(s+3));') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is encircled clockwise by Nyquist plot ,so N=-1 and P=1(given)") +N=-1;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=1;//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.")
\ No newline at end of file diff --git a/29/CH7/EX7.17.2.i/exa7_17_2_i_margin.jpg b/29/CH7/EX7.17.2.i/exa7_17_2_i_margin.jpg Binary files differnew file mode 100755 index 000000000..cb36f5f40 --- /dev/null +++ b/29/CH7/EX7.17.2.i/exa7_17_2_i_margin.jpg diff --git a/29/CH7/EX7.17.2.ii/exa7_17_2_ii.jpg b/29/CH7/EX7.17.2.ii/exa7_17_2_ii.jpg Binary files differnew file mode 100755 index 000000000..fe32eca2d --- /dev/null +++ b/29/CH7/EX7.17.2.ii/exa7_17_2_ii.jpg diff --git a/29/CH7/EX7.17.2.ii/exa7_17_2_ii.sce b/29/CH7/EX7.17.2.ii/exa7_17_2_ii.sce new file mode 100755 index 000000000..fb8acfc23 --- /dev/null +++ b/29/CH7/EX7.17.2.ii/exa7_17_2_ii.sce @@ -0,0 +1,20 @@ +//caption:stability_using_Nyquist_criterion +//example 7.17.2_ii +//page 237 +disp("for K=2.5") +g=(2.5*(s+1))/((s+0.5)*(s-2)); +g1=(2.5*(s1+1))/((s1+0.5)*(s1-2)); +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 (2.5*(s+1))/((s+0.5)*(s-2))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is encircled anticlockwise by Nyquist plot ,so N=1 and P=1(given)") +N=1;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=1;//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/CH7/EX7.17.2.ii/exa7_17_2_ii_margin.jpg b/29/CH7/EX7.17.2.ii/exa7_17_2_ii_margin.jpg Binary files differnew file mode 100755 index 000000000..a6fb6279d --- /dev/null +++ b/29/CH7/EX7.17.2.ii/exa7_17_2_ii_margin.jpg diff --git a/29/CH7/EX7.17.3/exa7_17_3.jpg b/29/CH7/EX7.17.3/exa7_17_3.jpg Binary files differnew file mode 100755 index 000000000..d44922db2 --- /dev/null +++ b/29/CH7/EX7.17.3/exa7_17_3.jpg diff --git a/29/CH7/EX7.17.3/exa7_17_3.sce b/29/CH7/EX7.17.3/exa7_17_3.sce new file mode 100755 index 000000000..ed8094a7b --- /dev/null +++ b/29/CH7/EX7.17.3/exa7_17_3.sce @@ -0,0 +1,22 @@ +//caption:stability_using_Nyquist_criterion +//example 7.17.3 +//page 238 +clf(); +s=%s; +s1=-s; +g=(s+0.25)/(s^2*(s+0.5)*(s+1)); +g1=(s1+0.25)/(s1^2*(s1+0.5)*(s1+1)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +mtlb_axis([-2000 500 -30 30]); +xtitle('Nyquist plot of (s+0.25)/(s^2*(s+0.5)*(s+1))') +figure; +show_margins(GH,'nyquist') +disp("since the point(-1+%i0) is encircled clockwise by Nyquist plot ,so N=-1 and P=1(given)") +N=-1;//no. of encirclement of -1+%i0 by G(s)H(s) plot anticlockwise +P=1;//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.")
\ No newline at end of file diff --git a/29/CH7/EX7.17.3/exa7_17_3_margin.jpg b/29/CH7/EX7.17.3/exa7_17_3_margin.jpg Binary files differnew file mode 100755 index 000000000..123c17506 --- /dev/null +++ b/29/CH7/EX7.17.3/exa7_17_3_margin.jpg diff --git a/29/CH7/EX7.17.5/exa7_17_5.jpg b/29/CH7/EX7.17.5/exa7_17_5.jpg Binary files differnew file mode 100755 index 000000000..f16d03b69 --- /dev/null +++ b/29/CH7/EX7.17.5/exa7_17_5.jpg diff --git a/29/CH7/EX7.17.5/exa7_17_5.sce b/29/CH7/EX7.17.5/exa7_17_5.sce new file mode 100755 index 000000000..b1a506ead --- /dev/null +++ b/29/CH7/EX7.17.5/exa7_17_5.sce @@ -0,0 +1,17 @@ +//caption:phase_margin +//example 7.17.5 +//page 241 +clf(); +s=%s; +s1=-s; +disp("for K=3") +g=(2.5*3)/(s*(0.4*s+1)*(0.2*s+1)); +g1=(2.5*3)/(s1*(0.4*s1+1)*(0.2*s1+1)); +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +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=")
\ No newline at end of file diff --git a/29/CH7/EX7.17.7/exa7_17_7.jpg b/29/CH7/EX7.17.7/exa7_17_7.jpg Binary files differnew file mode 100755 index 000000000..b2eccce6c --- /dev/null +++ b/29/CH7/EX7.17.7/exa7_17_7.jpg diff --git a/29/CH7/EX7.17.7/exa7_17_7.sce b/29/CH7/EX7.17.7/exa7_17_7.sce new file mode 100755 index 000000000..7e96fc75e --- /dev/null +++ b/29/CH7/EX7.17.7/exa7_17_7.sce @@ -0,0 +1,14 @@ +//caption:stability_using_Nyquist_criterion +//example 7.17.7 +//page 244 +clf(); +s=%s; +s1=-s; +g=(2.2/(s*(s+1)*(s^2+2*s+2))) +g1=(2.2/(s1*(s1+1)*(s1^2+2*s1+2))) +GH=syslin('c',g); +GH1=syslin('c',g1); +nyquist(GH); +nyquist(GH1); +mtlb_axis([-2.5 0.2 -75 75]); +disp("as the nyquist plot passes through the point -1+%i*0, so system is marginally stable and output represents sustained oscillations.")
\ No newline at end of file diff --git a/29/CH7/EX7.17.9/exa7_17_9.sce b/29/CH7/EX7.17.9/exa7_17_9.sce new file mode 100755 index 000000000..a7cebccaa --- /dev/null +++ b/29/CH7/EX7.17.9/exa7_17_9.sce @@ -0,0 +1,19 @@ +//caption: gain_margin_and_phase_margin +//example 7.17.9 +//page 245 +s=%s; +syms w; +s1=-s; +gh=(32/(s*(s+sqrt(6))^3)); +g=sym((32/(s*(s+sqrt(6))^3))); +s=%i*w; +a=eval(g); +w=sqrt(2); +b=float(eval(abs(a))); +disp(b,"at w=sqrt(2),|G(jw)H(jw)|="); +GH=syslin('c',gh); +gm=g_margin(GH); +pm=p_margin(GH); +disp(gm,"Gain margin="); +disp(pm,"Phase margin="); +disp("since gm=0 and pm=0, so system is marginally stable")
\ No newline at end of file diff --git a/29/CH7/EX7.19.1/exa7_19_1.jpg b/29/CH7/EX7.19.1/exa7_19_1.jpg Binary files differnew file mode 100755 index 000000000..db1758a5f --- /dev/null +++ b/29/CH7/EX7.19.1/exa7_19_1.jpg diff --git a/29/CH7/EX7.19.1/exa7_19_1.sce b/29/CH7/EX7.19.1/exa7_19_1.sce new file mode 100755 index 000000000..289a1268e --- /dev/null +++ b/29/CH7/EX7.19.1/exa7_19_1.sce @@ -0,0 +1,15 @@ +//caption:stability_using_bode_plot
+//example 7.19.1
+//page 280
+s=%s;
+g=50/((s+1)*(s+2));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+gm=g_margin(G)
+pm=p_margin(G)
+disp(gm,"gain_margin=");
+disp(pm,"phase_margin=");
+disp("since gain and phase margin are both positive so system is stable")
diff --git a/29/CH7/EX7.19.2/exa7_19_2.jpg b/29/CH7/EX7.19.2/exa7_19_2.jpg Binary files differnew file mode 100755 index 000000000..fcab09709 --- /dev/null +++ b/29/CH7/EX7.19.2/exa7_19_2.jpg diff --git a/29/CH7/EX7.19.2/exa7_19_2.sce b/29/CH7/EX7.19.2/exa7_19_2.sce new file mode 100755 index 000000000..1a4afa9ce --- /dev/null +++ b/29/CH7/EX7.19.2/exa7_19_2.sce @@ -0,0 +1,18 @@ +//caption:gain_margin_and_phase_margin
+//example 7.19.2
+//page 282
+s=%s;
+g=((2*(s+0.25))/(s^2*(s+1)*(s+0.5)));
+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/CH7/EX7.19.3/exa7_19_3.jpg b/29/CH7/EX7.19.3/exa7_19_3.jpg Binary files differnew file mode 100755 index 000000000..aceee9d22 --- /dev/null +++ b/29/CH7/EX7.19.3/exa7_19_3.jpg diff --git a/29/CH7/EX7.19.3/exa7_19_3.sce b/29/CH7/EX7.19.3/exa7_19_3.sce new file mode 100755 index 000000000..e30d85fb1 --- /dev/null +++ b/29/CH7/EX7.19.3/exa7_19_3.sce @@ -0,0 +1,15 @@ +//caption:stability_using_bode_plot
+//example 7.19.3
+//page 283
+s=%s;
+g=(48*(s+10))/(s*(s+20)*(s^2+2.4*s+16));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+gm=g_margin(G)
+pm=p_margin(G)
+disp(gm,"gain_margin=");
+disp(pm,"phase_margin=");
+disp("since gain and phase margin are both positive so system is stable")
\ No newline at end of file diff --git a/29/CH7/EX7.24.1/exa7_24_1.jpg b/29/CH7/EX7.24.1/exa7_24_1.jpg Binary files differnew file mode 100755 index 000000000..8ac36cda6 --- /dev/null +++ b/29/CH7/EX7.24.1/exa7_24_1.jpg diff --git a/29/CH7/EX7.24.1/exa7_24_1.sce b/29/CH7/EX7.24.1/exa7_24_1.sce new file mode 100755 index 000000000..221c3e93e --- /dev/null +++ b/29/CH7/EX7.24.1/exa7_24_1.sce @@ -0,0 +1,33 @@ +//caption:root_locus_description
+//example 7.24.1
+//page 295
+clc;
+s=%s;
+syms K
+G=K/(s*(s+4));
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+4))+K
+CH=sym('(s*(s+4))+K');
+disp('=0',CH,"characterstics_eq,CH=")
+eq=(s*(s+4))
+p=roots(eq)
+disp(p,"open loop poles are:")
+K=sym('-(s*(s+4))')
+d=diff(K,s)
+e=2*s+4
+P=2;
+Z=0;
+disp("since -2 lies on root locus so breakaway point is -2")
+for(k=0:1)
+ A=((2*k+1)*180)/(P-Z);
+ disp(A,"asymptote are at angle:")
+end
+x=((0-4)-0)/(P-Z) // (sum_of_P - sum_of_Z)/(P-Z)
+disp(x,"asymptotes intersect at ")
+disp("since |G(s)*H(s)|=1")
+disp("which gives K=8")
+k=8
+g=k/(s*(s+4))
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
\ No newline at end of file diff --git a/29/CH7/EX7.24.10/exa7_24_10.jpg b/29/CH7/EX7.24.10/exa7_24_10.jpg Binary files differnew file mode 100755 index 000000000..87989e185 --- /dev/null +++ b/29/CH7/EX7.24.10/exa7_24_10.jpg diff --git a/29/CH7/EX7.24.10/exa7_24_10.sce b/29/CH7/EX7.24.10/exa7_24_10.sce new file mode 100755 index 000000000..f4c63a56c --- /dev/null +++ b/29/CH7/EX7.24.10/exa7_24_10.sce @@ -0,0 +1,25 @@ +//Caption:overall_transfer_function_and_root_locus
+//example 7.24.10
+//page 314
+syms Ka Ke Kf Rf Lf eq N1 N2 N3 N4 N5
+//where Ka=amplifier_gain; Ke=error_detector_gain; Kf=motor_torque_const; Rf=field_resistance; Lf=field_inductance Jeq=moment_of_inertia; feq=coeff_of_viscous_friction;
+s=%s;
+d=N1/N2;
+e=N4/N3;
+f=N4/N5;
+n=N3/N5
+Ke=0.05; Kf=2; Rf=10; Lf=2; Jeq=0.5*10^-4; feq=10^-4; d=0.1; e=5; f=0.5;n=0.2;
+a=(1*Ke); //in series
+b=Kf/(Rf+s*Lf);
+c=1/(s*(Jeq*s+feq));
+g= (b*c) //in series
+h= (g*a) //in series
+j= (h*0.02) //in series
+k=j/(1+j*0.5);
+a1=1/20;
+cl=a1*k
+disp(cl,"C(s)/R(s)=");
+clf();
+G=syslin('c',cl)
+evans(G,200)
+xgrid(2)
diff --git a/29/CH7/EX7.24.11/exa7_24_11.jpg b/29/CH7/EX7.24.11/exa7_24_11.jpg Binary files differnew file mode 100755 index 000000000..718c2b055 --- /dev/null +++ b/29/CH7/EX7.24.11/exa7_24_11.jpg diff --git a/29/CH7/EX7.24.11/exa7_24_11.sce b/29/CH7/EX7.24.11/exa7_24_11.sce new file mode 100755 index 000000000..888da9d68 --- /dev/null +++ b/29/CH7/EX7.24.11/exa7_24_11.sce @@ -0,0 +1,54 @@ +//caption:root_locus
+//example 7.24.11
+//page 308
+clc;
+s=%s;
+syms K
+clf();
+g=K*(s+0.1)/(s*(s-0.2)*(s^2+s+0.6));
+Z=2
+P=2
+disp("the characterstics eq. is determined as:")
+CH=(s*(s-0.2)*(s^2+s+0.6))+K*(s+0.1)
+CH=sym('(s*(s-0.2)*(s^2+s+0.6))+K*(s+0.1)');
+disp('=0',CH,"characterstics_eq,CH=")
+eq=(s*(s-0.2)*(s^2+s+0.6))
+p=roots(eq)
+disp(p,"open loop poles are:")
+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*(s-0.2)*(s^2+s+0.6))/(s+0.1)')
+d=diff(K,s)
+e=3*s^4+2*s^3+0.64*s^2+0.08*s-0.12
+r=roots(e);
+disp(r,"r=")
+disp("since -0.37 and 0.08 lies on root locus, so the breakaway point is -0.37 and 0.08 ")
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(625*K^2-310*K+33)/(625*K-275)=0 ");
+disp("which gives:");
+disp("K=0.148 and 0.352");
+K1=0.148;
+K2=0.352
+a=((11-25*K1)/20)*s^2+K1/10//intersection of root locus with jw axis
+r1=roots(a)
+b=((11-25*K2)/20)*s^2+K2/10//intersection of root locus with jw axis
+r2=roots(b)
+disp(r1,r2,"root locus crosses imaginary axis at:")
+g=(s+0.1)/(s*(s-0.2)*(s^2+s+0.6));
+G=syslin('c',g)
+evans(G,200)
+xgrid(2)
+v=[-1 0.7 -2 2];
+mtlb_axis(v)
\ No newline at end of file diff --git a/29/CH7/EX7.24.2/exa7_24_2.jpg b/29/CH7/EX7.24.2/exa7_24_2.jpg Binary files differnew file mode 100755 index 000000000..aac54ccc7 --- /dev/null +++ b/29/CH7/EX7.24.2/exa7_24_2.jpg diff --git a/29/CH7/EX7.24.2/exa7_24_2.sce b/29/CH7/EX7.24.2/exa7_24_2.sce new file mode 100755 index 000000000..598cb2b11 --- /dev/null +++ b/29/CH7/EX7.24.2/exa7_24_2.sce @@ -0,0 +1,51 @@ +//caption:root_locus_description
+//example 7.24.2
+//page 296
+s=%s;
+syms K;
+GH=K/(s*(s+1)*(s+3))
+zeta=0.5
+//from given data
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+1)*(s+3))+K
+CH=sym('(s*(s+1)*(s+3))+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^3+4*s^2+3*s)')
+d=diff(K,s)
+e=-3*s^2-8*s-3
+r1=roots(e)
+disp(r1,"roots=")
+disp("-0.45 is break away point since it lies on root locus")
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(12-K)=0 ");
+disp("which gives:");
+disp("K=12, for margianl stability");
+K=12;
+k=12
+a=4*s^2+k//intersection of root locus with imaginary plane
+r=roots(a)
+g=k/(s*(s+1)*(s+3))
+G=syslin('c',g)
+evans(g,8)
+xgrid(2)
+disp("the line theta=acos(zeta)=60 intersects root locus at sa=(-0.35+i0.6)")
+disp("the value of K at s=sa is find to be 1.66 ")
+disp("the value of K at s=-4")
+disp("K=12")
+disp("at K=1.66")
+k=1.66
+H=1
+G=k/(s*(s+1)*(s+3))
+CL=G/(1+G*H)
+disp(CL,"C(s)/R(s)=")
\ No newline at end of file diff --git a/29/CH7/EX7.24.3/exa7_24_3.jpg b/29/CH7/EX7.24.3/exa7_24_3.jpg Binary files differnew file mode 100755 index 000000000..40a78186f --- /dev/null +++ b/29/CH7/EX7.24.3/exa7_24_3.jpg diff --git a/29/CH7/EX7.24.3/exa7_24_3.sce b/29/CH7/EX7.24.3/exa7_24_3.sce new file mode 100755 index 000000000..bbd630e38 --- /dev/null +++ b/29/CH7/EX7.24.3/exa7_24_3.sce @@ -0,0 +1,56 @@ +//caption:root_locus_description
+//example 7.24.3
+//page 299
+clc;
+s=%s;
+syms K
+G=K/(s*(s+6)*(s^2+4*s+13));
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+6)*(s^2+4*s+13))+K
+CH=sym('(s*(s+6)*(s^2+4*s+13))+K');
+disp('=0',CH,"characterstics_eq,CH=")
+eq=(s*(s+6)*(s^2+4*s+13))
+p=roots(eq)
+disp(p,"open loop poles are:")
+phi1=180-(atan(3/2)*180/%pi)
+phi2=atan(3/4)*180/%pi
+phi3=90
+phi_p2=180-(phi1+phi2+phi3)
+phi_p3=-phi_p2
+disp(phi_p2,"angle of departure for -2+3i=")
+disp(phi_p3,"angle of departure for -2-3i=")
+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*(s+6)*(s^2+4*s+13))')
+d=diff(K,s)
+e=-(4*s^3+30*s^2+74*s+78)
+f=-e;
+r=roots(f);
+disp(r,"r=")
+disp("since -4.2 lies on root locus, so the breakaway point is -4.2 ")
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(78-0.34*K)=0 ");
+disp("which gives:");
+disp("K=229.4");
+K=229.4;
+k=229.4;
+a=29.2*s^2+229.4//intersection of root locus with s plane
+r1=roots(a)
+g=k/(s*(s+6)*(s^2+4*s+13));
+g=syslin('c',g)
+evans(g,200)
+xgrid(2)
+disp(r1,"the point of intersection of root locus with imaginary axis =")
+
diff --git a/29/CH7/EX7.24.4/exa7_24_4.jpg b/29/CH7/EX7.24.4/exa7_24_4.jpg Binary files differnew file mode 100755 index 000000000..77635d7f6 --- /dev/null +++ b/29/CH7/EX7.24.4/exa7_24_4.jpg diff --git a/29/CH7/EX7.24.4/exa7_24_4.sce b/29/CH7/EX7.24.4/exa7_24_4.sce new file mode 100755 index 000000000..256e283d5 --- /dev/null +++ b/29/CH7/EX7.24.4/exa7_24_4.sce @@ -0,0 +1,52 @@ +//caption:root_locus
+//example 7.24.4
+//page 301
+clc;
+s=%s;
+syms K;
+GH=K/(s*(s+4)*(s^2+4*s+13))
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+4)*(s^2+4*s+13))+K
+CH=sym('(s*(s+4)*(s^2+4*s+13))+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*(s+4)*(s^2+4*s+13))')
+d=diff(K,s)
+e=(-4*s^3+24*s^2+58*s+52)
+r=roots(e)
+disp("since -2 lies on root locus so complex breakaway point is -2+i1.58 and -2-i1.58")
+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)
+g=k/(s*(s+2)*(s^2+2*s+2))
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
+eq=(s*(s+4)*(s^2+4*s+13))
+p=roots(eq)
+disp(p,"open loop poles are:")
+phi1=180-(atan(3/2)*180/%pi)
+phi2=atan(3/2)*180/%pi
+phi3=90
+phi_p2=180-(phi1+phi2+phi3)
+phi_p3=-phi_p2
+disp(phi_p2,"angle of departure for -2+3i=")
+disp(phi_p3,"angle of departure for -2-3i=")
diff --git a/29/CH7/EX7.24.6/exa7_24_6.jpg b/29/CH7/EX7.24.6/exa7_24_6.jpg Binary files differnew file mode 100755 index 000000000..0c0a17254 --- /dev/null +++ b/29/CH7/EX7.24.6/exa7_24_6.jpg diff --git a/29/CH7/EX7.24.6/exa7_24_6.sce b/29/CH7/EX7.24.6/exa7_24_6.sce new file mode 100755 index 000000000..a13dfb8cb --- /dev/null +++ b/29/CH7/EX7.24.6/exa7_24_6.sce @@ -0,0 +1,33 @@ +//caption:root_locus
+//example 7.24.6
+//page 304
+clc;
+s=%s;
+syms K;
+clf();
+g=(K*(s+1)/(s^2+0.4*s+0.4));
+eq=(s^2+0.4*s+0.4)
+p=roots(eq)
+disp(p,"open loop poles are:");
+P=2;
+Z=1;
+k=0
+ A=((2*k+1)*180)/(P-Z);
+ disp(A,"asymptote are at angle:")
+ CH=(s^2+0.4*s+0.4)+K*(s+1)
+CH=sym('(s^2+0.4*s+0.4)+K*(s+1)');
+disp('=0',CH,"characterstics_eq,CH=")
+K=sym('-(s^2+0.4*s+0.4)/(s+1)')
+d=diff(K,s)
+e=s*(s+2)
+disp("break away point s=-2 as it lies on root locus")
+disp("since |G(s)*H(s)|=1")
+disp("which gives K=3.6")
+k=3.6
+g=(k*(s+1))/(s^2+0.4*s+0.4);
+G=syslin('c',g)
+evans(g,200)
+xgrid(1)
+v=[-20 1 -2 2]
+mtlb_axis(v);
+disp(" poles s=(-0.2+j0.6 and -0.2-j0.6)are equidistant from the zero s=-1, hence rootlocus plot is arc of the circle with centre s=-1 and radius 1.")
diff --git a/29/CH7/EX7.24.7/exa7_24_7.jpg b/29/CH7/EX7.24.7/exa7_24_7.jpg Binary files differnew file mode 100755 index 000000000..20058fc5b --- /dev/null +++ b/29/CH7/EX7.24.7/exa7_24_7.jpg diff --git a/29/CH7/EX7.24.7/exa7_24_7.sce b/29/CH7/EX7.24.7/exa7_24_7.sce new file mode 100755 index 000000000..a46de18af --- /dev/null +++ b/29/CH7/EX7.24.7/exa7_24_7.sce @@ -0,0 +1,50 @@ +//caption:root_locus
+//example 7.24.7
+//page 306
+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/CH7/EX7.24.8/exa7_24_8.jpg b/29/CH7/EX7.24.8/exa7_24_8.jpg Binary files differnew file mode 100755 index 000000000..aac54ccc7 --- /dev/null +++ b/29/CH7/EX7.24.8/exa7_24_8.jpg diff --git a/29/CH7/EX7.24.8/exa7_24_8.sce b/29/CH7/EX7.24.8/exa7_24_8.sce new file mode 100755 index 000000000..c7b544658 --- /dev/null +++ b/29/CH7/EX7.24.8/exa7_24_8.sce @@ -0,0 +1,51 @@ +//caption:root_locus
+//example 7.24.8
+//page 308
+clc;
+s=%s;
+syms K;
+GH=K/(s*(s+1)*(s+3))
+zeta=0.5
+//from given data
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+1)*(s+3))+K
+CH=sym('(s*(s+1)*(s+3))+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^3+4*s^2+3*s)')
+d=diff(K,s)
+e=-3*s^2-8*s-3
+r1=roots(e)
+disp(r1,"roots=")
+disp("-0.45 is break away point since it lies on root locus")
+disp(routh,"routh=")
+disp("for given system to be marginally stable:");
+disp("(12-K)=0 ");
+disp("which gives:");
+disp("K=12, for margianl stability");
+K=12;
+k=12
+a=4*s^2+k//intersection of root locus with imaginary plane
+r=roots(a)
+disp(r,"intersection point of root locus with imaginary axis=")
+g=k/(s*(s+1)*(s+3))
+G=syslin('c',g)
+evans(g,8)
+xgrid(2)
+disp("for K=6")
+k=6;
+GH=k/(s*(s+1)*(s+3))
+gm=K/k //gm=K(marginal_stability)/K(desired)
+disp(gm,"gain_margin=")
+disp("the point where K=6 is s=1.2")
+pm=180+(-90-(atan(1.2/1)*180/%pi)-(atan(1.2/3)*180/%pi))
+disp(pm,"phase margin=")
\ No newline at end of file diff --git a/29/CH7/EX7.24.9/exa7_24_9.jpg b/29/CH7/EX7.24.9/exa7_24_9.jpg Binary files differnew file mode 100755 index 000000000..d75309474 --- /dev/null +++ b/29/CH7/EX7.24.9/exa7_24_9.jpg diff --git a/29/CH7/EX7.24.9/exa7_24_9.sce b/29/CH7/EX7.24.9/exa7_24_9.sce new file mode 100755 index 000000000..4d0b4ef0f --- /dev/null +++ b/29/CH7/EX7.24.9/exa7_24_9.sce @@ -0,0 +1,32 @@ +//caption:root_locus
+//example 7.24.9
+//page 308
+clc;
+s=%s;
+syms K
+clf();
+g=(K*(s^2+4)/(s*(s+1)));
+Z=2
+P=2
+disp("the characterstics eq. is determined as:")
+CH=(s*(s+1))+K*(s^2+4)
+CH=sym('(s*(s+1))+K*(s^2+4)');
+disp('=0',CH,"characterstics_eq,CH=")
+eq=(s*(s+1))
+p=roots(eq)
+disp(p,"open loop poles are:")
+K=sym('-(s*(s+1))/(s^2+4)')
+d=diff(K,s)
+e=2*s^2-8*s-8
+r=roots(e);
+disp(r,"r=")
+disp("since -0.82 lies on root locus, so the breakaway point is -0.82 ")
+disp("by putting s=-0.82 in |G(s)*H(s)|=1, the value of K at s=-0.82 is K=0.2")
+k=0.2
+g=(k*(s^2+4)/(s*(s+1)));
+G=syslin('c',g)
+evans(g,200)
+xgrid(2)
+
+disp("part (b)")
+disp("by putting s=-0.69+i0.9 in |G(s)*H(s)|=1, K=0.464")
diff --git a/29/CH7/EX7.5.1/exa7_5_1.sce b/29/CH7/EX7.5.1/exa7_5_1.sce new file mode 100755 index 000000000..a6fc5fde1 --- /dev/null +++ b/29/CH7/EX7.5.1/exa7_5_1.sce @@ -0,0 +1,20 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.1
+//page 202
+clc;
+s=%s;
+A=s^3+4.5*s^2+3.5*s+1.5;
+b=coeff(A)
+n=length(b)
+B=routh_t(A)
+disp(B,"routh table:");
+c=0;
+for(i=1:n)
+ if(B(i,1)<0)
+ c=c+1;
+ end
+end
+if(c>=1)
+ disp("system is unstable")
+else("system is stable")
+end
\ No newline at end of file diff --git a/29/CH7/EX7.5.2/exa7_5_2.sce b/29/CH7/EX7.5.2/exa7_5_2.sce new file mode 100755 index 000000000..416906422 --- /dev/null +++ b/29/CH7/EX7.5.2/exa7_5_2.sce @@ -0,0 +1,19 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.2
+//page 202
+s=%s;
+A=s^3+4*10^2*s^2+5*10^4*s+2*10^6;
+b=coeff(A)
+n=length(b)
+B=routh_t(A)
+disp(B,"routh table:");
+c=0;
+for(i=1:n)
+ if(B(i,1)<0)
+ c=c+1;
+ end
+end
+if(c>=1)
+ printf("\n system is unstable")
+else("system is stable")
+end
\ No newline at end of file diff --git a/29/CH7/EX7.5.3/exa7_5_3.sce b/29/CH7/EX7.5.3/exa7_5_3.sce new file mode 100755 index 000000000..4f01a0671 --- /dev/null +++ b/29/CH7/EX7.5.3/exa7_5_3.sce @@ -0,0 +1,31 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.3
+//page 203
+s=%s;
+A=s^5+4*1.5*s^4+4*s^3+4*s^2+5*s+10;
+C=2*s+5;
+CL=A/C;
+disp(CL,"C(s)/R(s)=");
+disp('=0',A,"characteristics eq is:")
+b=coeff(A)
+n=length(b)
+B=routh_t(A)
+disp(B,"routh table:");
+c=0;
+r=1;
+for(i=1:n)
+ if(B(i,1)<0)
+ c=c+1;
+ if(i==n & B(n,1)<0)
+ r=r;
+ else
+ r=r+1;
+ end
+ end
+end
+if(c>=1)
+ printf("system is unstable\n");
+else("system is stable " );
+end
+mprintf('no. of roots with positive real parts=%d',r);
+
diff --git a/29/CH7/EX7.5.4/exa7_5_4.sce b/29/CH7/EX7.5.4/exa7_5_4.sce new file mode 100755 index 000000000..198fe62b4 --- /dev/null +++ b/29/CH7/EX7.5.4/exa7_5_4.sce @@ -0,0 +1,22 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.4
+//page 203
+ieee (2)
+s=%s;
+A=s^5+s^4+2*s^3+2*s^2+11*s+10;
+b=coeff(A);
+n=length(b);
+B=routh_t(A);
+K=B;
+c=0;
+syms eps;
+x=limit(eps,eps,0);
+y=limit(((-1+2*eps)/eps),eps,0);
+z=limit(((-1+2*eps-10*eps^2)/(-1+2*eps)),eps,0);
+//after putting the limit we get:
+K(3,1)=0;
+K(4,1)=-%inf;
+K(5,1)=1;
+disp(K,"routh_table:")
+printf("There are two sign changes of first column ,hence the system is unstable \n" )
+
diff --git a/29/CH7/EX7.5.5/exa7_5_5.sce b/29/CH7/EX7.5.5/exa7_5_5.sce new file mode 100755 index 000000000..44243b312 --- /dev/null +++ b/29/CH7/EX7.5.5/exa7_5_5.sce @@ -0,0 +1,43 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.5
+//page 204
+s=%s;
+A=s^6+s^5+5*s^4+3*s^3+2*s^2-4*s-8;
+b=coeff(A)
+n=length(b)
+routh=[b([7,5,3,1]);b([6,4,2]),0];
+
+c=[routh(1,1),routh(1,3);routh(2,1),routh(2,3)]
+d=[routh(1,1),routh(1,4);routh(2,1),routh(2,4)]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),-det(c)/routh(2,1),-det(d)/routh(2,1),0];
+routh1=routh;
+e=[routh(2,1),routh(2,2);routh(3,1),routh(3,2)]
+f=[routh(2,1),routh(2,3);routh(3,1),routh(3,3)]
+routh=[routh;-det(e)/routh(3,1),-det(f)/routh(3,1),0,0];
+disp("since all elements of fourth row are zero, so we make auxiliary equation")
+A=sym('2*s^4+6*s^2-8')
+B=diff(A,s)
+routh=[routh1;8,12,0,0]
+g=[routh(3,1),routh(3,3);routh(4,1),routh(4,3)]
+routh=[routh;-det(routh(3:4,1:2))/routh(4,1),-det(g)/routh(4,1),0,0];
+routh=[routh;-det(routh(4:5,1:2))/routh(5,1),0,0,0];
+routh=[routh;-det(routh(5:6,1:2))/routh(6,1),0,0,0]
+disp(routh,"routh table:")
+c=0;
+r=1;
+for(i=1:n)
+ if(routh(i,1)<0)
+ c=c+1;
+ if(i==n & routh(n,1)<0)
+ r=r;
+ else
+ r=r+1;
+ end
+ end
+end
+if(c>=1)
+ printf("system is unstable\n")
+else("system is stable " )
+end
+mprintf('no. of roots with positive real parts=%d',r);
+
diff --git a/29/CH7/EX7.5.6/exa7_5_6.sce b/29/CH7/EX7.5.6/exa7_5_6.sce new file mode 100755 index 000000000..94f59a9d8 --- /dev/null +++ b/29/CH7/EX7.5.6/exa7_5_6.sce @@ -0,0 +1,28 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.6
+//page 206
+s=%s;
+syms T
+num=exp(-s*T);
+den=s*(s+2);
+G=num/den;
+H=1;
+a=(1+G*H);
+CL=G/a;
+CL=simple(CL);
+CH=s^2+2*s+exp(-s*T);
+//exp(-s*T)=1-sT+(sT)^2/2+....
+CH=s^2+(2-T)*s+1;
+disp('=0',CH,"characterstics_eq,CH=")
+c0=coeffs(CH,'s',0);
+c1=coeffs(CH,'s',1);
+c2=coeffs(CH,'s',2);
+b=[c0 c1 c2]
+n=3;
+routh=[b([3,1]);b([2]),0];
+routh=[routh;simple(-det(routh)/routh(2,1)),0]
+disp(routh,"routh=");
+disp("for given system to be stable:");
+disp("2-T>0");
+disp("which gives:");
+disp("T<2");
diff --git a/29/CH7/EX7.5.7.a/exa7_5_7_a.sce b/29/CH7/EX7.5.7.a/exa7_5_7_a.sce new file mode 100755 index 000000000..777f5da0a --- /dev/null +++ b/29/CH7/EX7.5.7.a/exa7_5_7_a.sce @@ -0,0 +1,23 @@ +//caption:stability_using_Routh-hurwitz_criterion
+//example 7.5.7.(a)
+//page 207
+s=%s;
+syms T K
+P=s*(s*(s+10)+T);
+CH=sym('s^3+10*s^2+T*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 stable:");
+disp("((10*T-K)/10)>0 and K>0");
+disp("which gives:");
+disp("0<K<10T");
diff --git a/29/CH7/EX7.5.7.b/exa7_5_7_b.sce b/29/CH7/EX7.5.7.b/exa7_5_7_b.sce new file mode 100755 index 000000000..f0a751af5 --- /dev/null +++ b/29/CH7/EX7.5.7.b/exa7_5_7_b.sce @@ -0,0 +1,25 @@ +//caption:value_of_K_of_characterstics_eq
+//example 7.5.7.(b)
+//page 207
+s=%s;
+syms K s1;
+CH=s^3+10*s^2+18*s+K
+s=s1-1;
+CH=eval(CH);
+CH=simple(CH);
+disp('=0',CH,"characterstics_eq,CH=");
+c0=coeffs(CH,'s1',0);
+c1=coeffs(CH,'s1',1);
+c2=coeffs(CH,'s1',2);
+c3=coeffs(CH,'s1',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 stable:");
+disp("((-(K-16))/7)>0 and K-9>0");
+disp("which gives:");
+disp("9<K<16");
diff --git a/29/CH7/EX7.5.8/exa7_5_8.sce b/29/CH7/EX7.5.8/exa7_5_8.sce new file mode 100755 index 000000000..b3b883b12 --- /dev/null +++ b/29/CH7/EX7.5.8/exa7_5_8.sce @@ -0,0 +1,27 @@ +//caption:value_of_K_in_terms_of_T1_and_T2
+//example 7.5.8
+//page 207
+s=%s;
+syms K T1 T2;
+m=s*(s*T1+1)*(s*T2+1)
+G=K/m;
+CH=1+G;
+disp("on simplyfying CH")
+CH=m+K;
+CH=simple(CH);
+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 stable:");
+disp("K>0 and (-(K*T1*T2-T2-T1)/(T2+T1))>0");
+disp("which gives:");
+disp("0<K<((1/T1)+(1/T2))");
\ No newline at end of file diff --git a/29/CH8/EX8.6.1/exa8_6_1.sce b/29/CH8/EX8.6.1/exa8_6_1.sce new file mode 100755 index 000000000..57c5eb943 --- /dev/null +++ b/29/CH8/EX8.6.1/exa8_6_1.sce @@ -0,0 +1,40 @@ +//caption:design_suitable_compensator
+//example 8.6.1
+//page 339
+s=%s;
+clf();
+syms K;
+g=(K/(s*(1+0.2*s)));
+Kv=limit(s*g,s,0);//static velocity error coefficient
+//since Kv=10
+K=10;
+g=(10/(s*(1+0.2*s)));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+xtitle("uncompensated system")
+[gm,freqGM]=g_margin(G);
+[pm,freqPM]=p_margin(G);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq=");
+disp(pm,"phase_margin=");
+disp((freqPM*2*%pi),"phase_margin_freq_or_gain_cross_over_frequency=");
+disp("since P.M is less than desired value so we need phase lead network ")
+disp("selecting zero of lead compensating network at w=5.5rad/sec and pole at w=13.8rad/sec and applying gain to account attenuatin factor .")
+gc=(1+0.18*s)/(1+0.072*s)
+Gc=syslin('c',gc)
+disp(Gc,"transfer function of lead compensator=");
+G1=G*Gc
+disp(G1,"overall transfer function=");
+fmin=0.01;
+fmax=100;
+figure();
+bode(G1, fmin, fmax);
+show_margins(G1)
+xtitle("compensated system")
+[gm,freqGM]=g_margin(G1);
+[pm,freqPM]=p_margin(G1);
+disp(pm,"phase_margin_of_compensated_system=");
+disp((freqPM*2*%pi),"gain_cross_over_frequency=");
\ No newline at end of file diff --git a/29/CH8/EX8.6.1/exa8_6_1_compensated.jpg b/29/CH8/EX8.6.1/exa8_6_1_compensated.jpg Binary files differnew file mode 100755 index 000000000..13582834c --- /dev/null +++ b/29/CH8/EX8.6.1/exa8_6_1_compensated.jpg diff --git a/29/CH8/EX8.6.1/exa8_6_1_uncompensated.jpg b/29/CH8/EX8.6.1/exa8_6_1_uncompensated.jpg Binary files differnew file mode 100755 index 000000000..c1dd97c6a --- /dev/null +++ b/29/CH8/EX8.6.1/exa8_6_1_uncompensated.jpg diff --git a/29/CH8/EX8.6.2/exa8_6_2.sce b/29/CH8/EX8.6.2/exa8_6_2.sce new file mode 100755 index 000000000..52026a035 --- /dev/null +++ b/29/CH8/EX8.6.2/exa8_6_2.sce @@ -0,0 +1,41 @@ +//caption:design_phase_lead_compensator
+//example 8.6.2
+//page 340
+clc;
+s=%s;
+clf();
+syms K;
+g=(K/(s^2*(1+0.05*s)));
+Ka=limit(s^2*g,s,0);//static acceleration error coefficient
+//since Ka=100
+K=100;
+g=(100/(s^2*(1+0.05*s)));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+xtitle("uncompensated system")
+[gm,freqGM]=g_margin(G);
+[pm,freqPM]=p_margin(G);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq=");
+disp(pm,"phase_margin=");
+disp((freqPM*2*%pi),"phase_margin_freq_or_gain_cross_over_frequency=");
+disp("since P.M is negaative so system is unstable ")
+disp("selecting zero of lead compensating network at w=5rad/sec and pole at w=54rad/sec and applying gain to account attenuatin factor .")
+gc=(1+0.2*s)/(1+0.0186*s)
+Gc=syslin('c',gc)
+disp(Gc,"transfer function of lead compensator=");
+G1=G*Gc
+disp(G1,"overall transfer function=");
+fmin=0.01;
+fmax=100;
+figure();
+bode(G1, fmin, fmax)
+show_margins(G1)
+xtitle("compensated system")
+[gm,freqGM]=g_margin(G1);
+[pm,freqPM]=p_margin(G1);
+disp(pm,"phase_margin_of_compensated_system=");
+disp((freqPM*2*%pi),"gain_cross_over_frequency=");
\ No newline at end of file diff --git a/29/CH8/EX8.6.2/exa8_6_2_compensated.jpg b/29/CH8/EX8.6.2/exa8_6_2_compensated.jpg Binary files differnew file mode 100755 index 000000000..1f281ea73 --- /dev/null +++ b/29/CH8/EX8.6.2/exa8_6_2_compensated.jpg diff --git a/29/CH8/EX8.6.2/exa8_6_2_uncompensated.jpg b/29/CH8/EX8.6.2/exa8_6_2_uncompensated.jpg Binary files differnew file mode 100755 index 000000000..d22203e90 --- /dev/null +++ b/29/CH8/EX8.6.2/exa8_6_2_uncompensated.jpg diff --git a/29/CH8/EX8.6.3/exa8_6_3.sce b/29/CH8/EX8.6.3/exa8_6_3.sce new file mode 100755 index 000000000..24a6be898 --- /dev/null +++ b/29/CH8/EX8.6.3/exa8_6_3.sce @@ -0,0 +1,44 @@ +//caption:design_suitable_compensator
+//example 8.6.3
+//page 344
+clc;
+s=%s;
+clf();
+syms K;
+g=(K/(s*(1+0.5*s)*(1+0.2*s)));
+Kv=1/0.125//static velocity error coefficient(Kv=desired output velocity/steady state error)
+//since Kv=8, as system is type 1 , so K=Kv;
+K=8;
+g=(8/(s*(1+0.5*s)*(1+0.2*s)));
+G=syslin('c',g)
+fmin=0.01;
+fmax=100;
+bode(G, fmin, fmax)
+show_margins(G)
+xtitle("uncompensated system")
+[gm,freqGM]=g_margin(G);
+[pm,freqPM]=p_margin(G);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq_or_phase_cross_over_frequency==");
+disp(pm,"phase_margin=");
+disp((freqPM*2*%pi),"phase_margin_freq_or_gain_cross_over_frequency=");
+disp("since gain crossover freq and phase crossover freq are very close to each other. So, system is marginally stable");
+disp("so we need phase lag network ")
+disp("selecting zero of lead compensating network at w=0.18rad/sec and pole at w=0.04rad/sec and applying gain to account attenuatin factor .")
+gc=(1+5.55*s)/(1+24.7*s)
+Gc=syslin('c',gc)
+disp(Gc,"transfer function of lead compensator=");
+G1=G*Gc
+disp(G1,"overall transfer function=");
+fmin=0.01;
+fmax=100;
+figure();
+bode(G1, fmin, fmax)
+show_margins(G1)
+xtitle("compensated system")
+[gm,freqGM]=g_margin(G1);
+[pm,freqPM]=p_margin(G1);
+disp(gm,"gain_margin=");
+disp((freqGM*2*%pi),"gain_margin_freq_or_phase_cross_over_frequency==");
+disp(pm,"phase_margin_of_compensated_system=");
+disp((freqPM*2*%pi),"gain_cross_over_frequency=");
\ No newline at end of file diff --git a/29/CH8/EX8.6.3/exa8_6_3_compensated.jpg b/29/CH8/EX8.6.3/exa8_6_3_compensated.jpg Binary files differnew file mode 100755 index 000000000..0d2769ff0 --- /dev/null +++ b/29/CH8/EX8.6.3/exa8_6_3_compensated.jpg diff --git a/29/CH8/EX8.6.3/exa8_6_3_uncompensated.jpg b/29/CH8/EX8.6.3/exa8_6_3_uncompensated.jpg Binary files differnew file mode 100755 index 000000000..a376ee536 --- /dev/null +++ b/29/CH8/EX8.6.3/exa8_6_3_uncompensated.jpg diff --git a/29/CH9/EX9.10.10/exa9_10_10.sce b/29/CH9/EX9.10.10/exa9_10_10.sce new file mode 100755 index 000000000..9707dd3c0 --- /dev/null +++ b/29/CH9/EX9.10.10/exa9_10_10.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.10
+//page 393
+s=%s;
+g=(s^2+6*s+8)/((s+3)*(s^2+2*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/CH9/EX9.10.11/exa9_10_11.sce b/29/CH9/EX9.10.11/exa9_10_11.sce new file mode 100755 index 000000000..c99f11012 --- /dev/null +++ b/29/CH9/EX9.10.11/exa9_10_11.sce @@ -0,0 +1,27 @@ +//caption:obtain_time_response
+//example 9.10.11
+//page 394
+s=%s;
+syms t
+A=[0 1;-2 0]
+B=[1 -1]
+x0=[1 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
+//for calculating state transistion matrix
+ip=[0 0;0 0]
+i=1;j=1;
+for i=1:2
+ for j=1:2
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ i=i+1;
+end
+disp(ip,"state transistion matrix,ip(t)=");
+x=ip*x0
+y=x(1,1)-x(2,1)
+y=simple(y) //output
+disp(y,"time response of the system,y(t)=");
diff --git a/29/CH9/EX9.10.12.i/exa9_10_12_i.sce b/29/CH9/EX9.10.12.i/exa9_10_12_i.sce new file mode 100755 index 000000000..fc9dd8742 --- /dev/null +++ b/29/CH9/EX9.10.12.i/exa9_10_12_i.sce @@ -0,0 +1,25 @@ +//caption:obtain_zero_input_response
+//example 9.10.12_(i)
+//page 395
+s=%s;
+syms t
+A=[0 1;-2 -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
+//for calculating state transistion matrix
+ip=[0 0;0 0]
+i=1;j=1;
+for i=1:2
+ for j=1:2
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ i=i+1;
+end
+disp(ip,"state transistion matrix,ip(t)=");
+x=ip*x0
+disp(x,"zero input response of the system,x(t)=");
diff --git a/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce b/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce new file mode 100755 index 000000000..6e2ab4348 --- /dev/null +++ b/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce @@ -0,0 +1,18 @@ +//caption:obtain_zero_state_response
+//example 9.10.12_(ii)
+//page 395
+s=%s;
+syms t
+A=[0 1;-2 -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);
+//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,"zero input response of the system,x(t)=");
diff --git a/29/CH9/EX9.10.13/exa9_10_13.sce b/29/CH9/EX9.10.13/exa9_10_13.sce new file mode 100755 index 000000000..a44ac45cc --- /dev/null +++ b/29/CH9/EX9.10.13/exa9_10_13.sce @@ -0,0 +1,13 @@ +//caption:obtain_time_response
+//example 9.10.13
+//page 397
+syms t;
+A=[0 1;-2 0]
+x0=[1 1]'
+[r c]=size(A);//size of matrix A
+//since exp(At)=I+A*t+(A*t)^2/2+(A*t)^3/3+...
+I=eye(r,c)
+p=I+A*t+(A*t)^2/2+(A*t)^3/3
+x=p*x0;
+disp(x(1,1),"time response of the system,x1(t)=");
+disp(x(2,1),"time response of the system,x2(t)=");
\ No newline at end of file diff --git a/29/CH9/EX9.10.14/exa9_10_14.sce b/29/CH9/EX9.10.14/exa9_10_14.sce new file mode 100755 index 000000000..55b6a520b --- /dev/null +++ b/29/CH9/EX9.10.14/exa9_10_14.sce @@ -0,0 +1,39 @@ +//caption:obtain_time_response_using_diagonalization_process
+//example 9.10.14
+//page 398
+syms m11 m22 m21 m12 t;
+s=%s;
+poly(0,"l");
+A=[1 4;-2 -5]
+B=[0;1]
+C=[1;0]'
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+I=eye(r,c);
+p=l*I-A;//l*I-A where I is identity matrix
+q=det(p)//determinant of lI-A
+
+//roots of q are -1 and -3
+l1=-1;
+l2=-3;
+//for determining modal matrix
+x1=[m11;m21]
+q1=(l1*I-A)*x1
+//on solving we find m11=1, m21=-0.5
+m11=1;m21=-0.5
+x2=[m12;m22]
+q2=(l2*I-A)*x1
+//on solving we find m12=1, m22=-1
+m12=1;m22=-1
+M=[m11 m12;m21 m22]
+M1=inv(M);
+k1=M1*A*M;
+z0=M1*x0;
+k2=M1*B
+Z=inv(s*I-k1)*z0+(inv(s*I-k1)*k2)*(1/s);
+X=M*Z
+x=[0;0]
+x(1,1)=ilaplace(X(1,1),s,t);
+x(2,1)=ilaplace(X(2,1),s,t);
+y=C*x
+disp(y,"output_equation_is,y(t)=")
\ No newline at end of file diff --git a/29/CH9/EX9.10.15/exa9_10_15.sce b/29/CH9/EX9.10.15/exa9_10_15.sce new file mode 100755 index 000000000..34616873e --- /dev/null +++ b/29/CH9/EX9.10.15/exa9_10_15.sce @@ -0,0 +1,32 @@ +//caption:obtain_time_response_using_diagonalization_process
+//example 9.10.15
+//page 403
+syms t;
+s=%s;
+poly(0,"l");
+A=[0 1;-6 -5]
+B=[0;1]
+C=[6 1]
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+I=eye(r,c);
+p=l*I-A;//l*I-A where I is identity matrix
+q=det(p)//determinant of lI-A
+//roots of q are -1 and -3
+l1=-2;
+l2=-3;
+//for determining vandermonde's matrix
+P=[1 1;l1 l2];
+P1=inv(P);
+k1=P1*A*P;
+z0=P1*x0;
+k2=P1*B
+Z=inv(s*I-k1)*z0+(inv(s*I-k1)*k2)*(1/s);
+X=P*Z
+X(2,1)=-5/(s^2+5*s+6)
+x=[0;0]
+x(1,1)=ilaplace(X(1,1),s,t);
+x(2,1)=ilaplace(X(2,1),s,t);
+y=C*x
+y=simple(y)
+disp(y,"output_equation_is,y(t)=")
\ No newline at end of file diff --git a/29/CH9/EX9.10.16/exa9_10_16.sce b/29/CH9/EX9.10.16/exa9_10_16.sce new file mode 100755 index 000000000..f8dbe0564 --- /dev/null +++ b/29/CH9/EX9.10.16/exa9_10_16.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.16
+//page 406
+clc;
+s=%s
+A=[1 -2;4 -5]
+B=[2;1]
+C=[1 1]
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.17/exa9_10_17.sce b/29/CH9/EX9.10.17/exa9_10_17.sce new file mode 100755 index 000000000..70fc9f052 --- /dev/null +++ b/29/CH9/EX9.10.17/exa9_10_17.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.17
+//page 407
+s=%s
+A=[-3 1;0 -1]
+B=[1;1]
+C=[1 1]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.18/exa9_10_18.sce b/29/CH9/EX9.10.18/exa9_10_18.sce new file mode 100755 index 000000000..31700cf3c --- /dev/null +++ b/29/CH9/EX9.10.18/exa9_10_18.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.17
+//page 407
+s=%s
+A=[0 3;-2 -5]
+B=[1 1;1 1]
+C=[2 1;1 0]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.20/exa9_10_20.sce b/29/CH9/EX9.10.20/exa9_10_20.sce new file mode 100755 index 000000000..2f15184c5 --- /dev/null +++ b/29/CH9/EX9.10.20/exa9_10_20.sce @@ -0,0 +1,14 @@ +//caption:check_for_contrallability_of_system
+//example 9.10.20
+//page 410
+A=[0 1 0;0 0 1;0 -2 -3]
+B=[0 1;0 0;1 1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+S=[P(1) P(4) P(7);P(2) P(5) P(8);P(3) P(6) P(9)];//collecting columns from P to form a square matrix (3*3)
+d=det(S);
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.10.21/exa9_10_21.sce b/29/CH9/EX9.10.21/exa9_10_21.sce new file mode 100755 index 000000000..beae1cf20 --- /dev/null +++ b/29/CH9/EX9.10.21/exa9_10_21.sce @@ -0,0 +1,22 @@ +//caption:check_for_contrallability_and_observability_of_system
+//example 9.10.21
+//page 411
+A=[0 1 0;0 0 1;-6 -11 -6]
+B=[1 0 1]'
+C=[10 5 1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=det(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
+P1=obsv_mat(A,C);
+disp(P1,"Observability Matrix=");
+d1=det(P1)
+if d1==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.10.22/exa9_10_22.sce b/29/CH9/EX9.10.22/exa9_10_22.sce new file mode 100755 index 000000000..f3383b3ae --- /dev/null +++ b/29/CH9/EX9.10.22/exa9_10_22.sce @@ -0,0 +1,30 @@ +//caption:check_for_contrallability_and_observability_of_system
+//example 9.10.21
+//page 411
+s=%s;
+g=(10*(s+3))/((s+4)*(s+2)^2);
+CL=syslin('c',g);
+disp(CL,"Y(s)/U(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+A=SS(2)
+B=SS(3)
+C=SS(4)
+P=cont_mat(A,B);
+P=round(P)
+disp(P,"Controllability Matrix=");
+d=det(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
+P1=obsv_mat(A,C);
+P1=round(P1);
+disp(P1,"Observability Matrix=");
+d1=det(P1)
+if d1==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end
\ No newline at end of file diff --git a/29/CH9/EX9.10.4.a/exa9_10_4_a.sce b/29/CH9/EX9.10.4.a/exa9_10_4_a.sce new file mode 100755 index 000000000..850208a93 --- /dev/null +++ b/29/CH9/EX9.10.4.a/exa9_10_4_a.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.4_a
+//page 387
+s=%s;
+g=1/((s+1)*(s+3));
+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/CH9/EX9.10.4.b/exa9_10_4_b.sce b/29/CH9/EX9.10.4.b/exa9_10_4_b.sce new file mode 100755 index 000000000..c8d910df6 --- /dev/null +++ b/29/CH9/EX9.10.4.b/exa9_10_4_b.sce @@ -0,0 +1,12 @@ +//caption:obtain_state_matrix
+//example 9.10.4_b
+//page 387
+clc;
+s=%s;
+g=(2*s+1)/(s^2+2);
+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")
diff --git a/29/CH9/EX9.10.5/exa9_10_5.sce b/29/CH9/EX9.10.5/exa9_10_5.sce new file mode 100755 index 000000000..94c55aa93 --- /dev/null +++ b/29/CH9/EX9.10.5/exa9_10_5.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.5
+//page 388
+s=%s;
+g=(s+3)/(s^2+3*s+4);
+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/CH9/EX9.10.6/exa9_10_6.sce b/29/CH9/EX9.10.6/exa9_10_6.sce new file mode 100755 index 000000000..901889d19 --- /dev/null +++ b/29/CH9/EX9.10.6/exa9_10_6.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.6
+//page 389
+s=%s;
+g=(s^2+3*s+2)/(s^3+9*s^2+26*s+24);
+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/CH9/EX9.10.7/exa9_10_7.sce b/29/CH9/EX9.10.7/exa9_10_7.sce new file mode 100755 index 000000000..5c78cd19e --- /dev/null +++ b/29/CH9/EX9.10.7/exa9_10_7.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.7
+//page 390
+s=%s;
+g=(s+3)/((s+1)*(s+2));
+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/CH9/EX9.10.9/exa9_10_9.sce b/29/CH9/EX9.10.9/exa9_10_9.sce new file mode 100755 index 000000000..964be6667 --- /dev/null +++ b/29/CH9/EX9.10.9/exa9_10_9.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.9
+//page 392
+s=%s;
+g=(10*(s+3))/((s+4)*(s+2)^2);
+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/CH9/EX9.8.1/exa9_8_1.sce b/29/CH9/EX9.8.1/exa9_8_1.sce new file mode 100755 index 000000000..cddb6f979 --- /dev/null +++ b/29/CH9/EX9.8.1/exa9_8_1.sce @@ -0,0 +1,13 @@ +//caption:check_for_contrallability_of_system
+//example 9.8.1
+//page 381
+A=[1 1;0 -1]
+B=[1;0]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.8.2/exa9_8_2.sce b/29/CH9/EX9.8.2/exa9_8_2.sce new file mode 100755 index 000000000..2d8176767 --- /dev/null +++ b/29/CH9/EX9.8.2/exa9_8_2.sce @@ -0,0 +1,13 @@ +//caption:check_for_contrallability_of_system
+//example 9.8.2
+//page 381
+A=[-2 0;0 -1]
+B=[1;1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.9.1.a/exa9_9_1_a.sce b/29/CH9/EX9.9.1.a/exa9_9_1_a.sce new file mode 100755 index 000000000..ae0f6489b --- /dev/null +++ b/29/CH9/EX9.9.1.a/exa9_9_1_a.sce @@ -0,0 +1,14 @@ +//caption:check_for_observability_of_system
+//example 9.9.1_a
+//page 383
+A=[0 1;-2 -3]
+B=[0;1]
+C=[1 1]
+P=obsv_mat(A,C);
+disp(P,"Observability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.9.1.b/exa9_9_1_b.sce b/29/CH9/EX9.9.1.b/exa9_9_1_b.sce new file mode 100755 index 000000000..e4eeec6ae --- /dev/null +++ b/29/CH9/EX9.9.1.b/exa9_9_1_b.sce @@ -0,0 +1,14 @@ +//caption:check_for_observability_of_system
+//example 9.9.1_b
+//page 383
+A=[-2 1;0 1]
+B=[1;1]
+C=[1 1]
+P=obsv_mat(A,C);
+disp(P,"Observability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file diff --git a/29/DEPENDENCIES/parallel.sce b/29/DEPENDENCIES/parallel.sce new file mode 100755 index 000000000..1564c4eab --- /dev/null +++ b/29/DEPENDENCIES/parallel.sce @@ -0,0 +1,3 @@ +function [y]= parallel(sys1,sys2)
+y=sys1+sys2;
+endfunction
\ No newline at end of file diff --git a/29/DEPENDENCIES/series.sce b/29/DEPENDENCIES/series.sce new file mode 100755 index 000000000..0f9ff15bd --- /dev/null +++ b/29/DEPENDENCIES/series.sce @@ -0,0 +1,3 @@ +function [y] = series (sys1,sys2)
+y = sys1*sys2
+endfunction
\ No newline at end of file |