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 /46 | |
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 '46')
59 files changed, 879 insertions, 0 deletions
diff --git a/46/CH10/EX10.1/Example10_1.sce b/46/CH10/EX10.1/Example10_1.sce new file mode 100755 index 000000000..bf24aea7f --- /dev/null +++ b/46/CH10/EX10.1/Example10_1.sce @@ -0,0 +1,19 @@ +//Example 10.1 +clear +clc +t1=60;//Fahrenheit +t2=100;//Fahrenheit +p1=3;//psi +p2=15;//psi +T1=71;//Fahrenheit +T2=75;//Fahrenheit +pb=((T2-T1)/(t2-t1))*100; +disp('%',pb,'proportional band=') +Gain=(p2-p1)/(T2-T1); +disp('psi/F',Gain,'Gain=') +//Assume pb is changed to 75% then +pb=75;//% +T=(pb*(t2-t1))/100; +disp('Fahrenheit',T,'T=') +Gain=(p2-p1)/T; +disp('psi/F',Gain,'Gain=') diff --git a/46/CH12/EX12.1/Example12_1.sce b/46/CH12/EX12.1/Example12_1.sce new file mode 100755 index 000000000..e71b2cc9f --- /dev/null +++ b/46/CH12/EX12.1/Example12_1.sce @@ -0,0 +1,13 @@ +//Example 12.1
+clc
+syms Gc G1 G2 G3 H1 H2 R U1;
+G=Gc*G1*G2*G3*H1*H2;
+g=Gc*G1*G2*G3/(1+G);
+disp(g,'C/R=')
+g1=G2*G3/(1+G);
+disp(g1,'C/U1=')
+g2=G3*H1*H2/(1+G);
+disp(g2,'B/U2=')
+C1=g*R;
+C2=g1*U1;
+disp(C1+C2,'C=')
diff --git a/46/CH12/EX12.2/Example12_2.sce b/46/CH12/EX12.2/Example12_2.sce new file mode 100755 index 000000000..0b0f8d3ac --- /dev/null +++ b/46/CH12/EX12.2/Example12_2.sce @@ -0,0 +1,8 @@ +//Example 12.2
+clc
+syms Gc1 Gc2 G1 G2 G3 H1 H2;
+Ga=Gc2*G1/.H2
+Gb=G2*G3
+g=Gc1*Ga*Gb/.H1;
+g=simple(g);
+disp(g,'C/R=')
\ No newline at end of file diff --git a/46/CH14/EX14.1/Example14_1.sce b/46/CH14/EX14.1/Example14_1.sce new file mode 100755 index 000000000..dadfd2ed2 --- /dev/null +++ b/46/CH14/EX14.1/Example14_1.sce @@ -0,0 +1,28 @@ +//Example 14.1 +clear +clc +s=%s; +G1=10*((0.5*s+1)/s); +G2=1/(2*s+1); +H=1; +G=G1*G2*H +//The characteristic equation is therefore +disp('1+G=0') +disp('=0',1+G,'1+G='); +//which is equivalent to +disp("s^2+3*s+5=0"); +h=poly([5,3,1],'s','coeff'); +r=roots(h) +disp(r,'roots=') +//Since the real part of roots are negative, the system is stable +n=length(r); +c=0; +for i=1:n +if (real(r(i,1))<0) +c=c+1; +end +end +if(c>=1) +printf("system is stable\n") +else ("system is unstable") +end
\ No newline at end of file diff --git a/46/CH14/EX14.2/Example14_2.sce b/46/CH14/EX14.2/Example14_2.sce new file mode 100755 index 000000000..183ea422e --- /dev/null +++ b/46/CH14/EX14.2/Example14_2.sce @@ -0,0 +1,18 @@ +//Example 14.2 +clear; +clc +h=poly([2,4,5,3,1],'s','coeff'); +r=routh_t(h) +//Since there is no change in sign in the first column, there are no roots having positive real parts, and the system is stable. +y=coeff(h); +n=length(y); +c=0; +for i=1:n +if (r(i,1)<0) +c=c+1; +end +end +if(c>=1) +printf("system is unstable") +else ("system is stable") +end
\ No newline at end of file diff --git a/46/CH14/EX14.3/Example14_3.sce b/46/CH14/EX14.3/Example14_3.sce new file mode 100755 index 000000000..58e2d550a --- /dev/null +++ b/46/CH14/EX14.3/Example14_3.sce @@ -0,0 +1,32 @@ +//Example 14.3
+clc
+syms Kc s s3;
+G1=1/((s+1)*(0.5*s+1));
+H=3/(s+3);
+G=Kc*G1*H;
+G=simple(G);
+//The characteristic equation is therefore
+disp('1+G=0')
+disp('=0',1+G,'1+G=');
+//which is equivalent to
+disp("s^3+6*s^2+11*s+6+6*Kc=0")
+routh=[1 11;6 6+6*Kc]
+routh=[routh;-det(routh(1:2,1:2))/routh(2,1),0]
+routh=[routh;-det(routh(2:3,1:2))/routh(3,1),0]
+routh=simple(routh)
+disp('>0',routh(3,1))
+disp('Kc<10')
+Kc=10;
+routh=horner(routh,Kc);
+routh=dbl(routh)
+C=routh(2,1);
+D=routh(2,2);
+p=poly([D 0 C],'s','coeff')
+disp('6*s^2+66=0')
+r=roots(p)
+disp('=0',simple((s-r(1,1))*(s-r(2,1))*(s-s3)))
+//On comparing with the equation
+poly([6+6*Kc 11 6 1],'s','coeff')
+//we get
+s3=-6;
+printf("s1=3.3166248*i,s2=3.3166248*i,,s3=6\n")
\ No newline at end of file diff --git a/46/CH14/EX14.4/Example14_4.sce b/46/CH14/EX14.4/Example14_4.sce new file mode 100755 index 000000000..1a8917620 --- /dev/null +++ b/46/CH14/EX14.4/Example14_4.sce @@ -0,0 +1,30 @@ +//Example 14.4
+clc
+s=%s;
+tau1=1;
+tau2=1/2;
+tau3=1/3;
+taui=0.25;
+Kc=5;
+n=Kc/(tau1*tau2*tau3)*(taui*s+1);
+d=taui*s*(s+(1/tau1))*(s+(1/tau2))*(s+(1/tau3));
+G=syslin('c',n/d);
+//The characteristic equation is therefore
+disp('1+G=0')
+disp('=0',1+G,'1+G=');
+//which is equivalent to
+disp("s^4+6*s^3+11*s^2+36*s+120=0")
+h=poly([120 36 11 6 1],'s','coeff')
+r=routh_t(h)
+y=coeff(h);
+n=length(y);
+c=0;
+for i=1:n
+if (r(i,1)<0)
+c=c+1;
+end
+end
+if(c>=1)
+printf("system is unstable\n")
+else ("system is stable")
+end
diff --git a/46/CH15/EX15.1/Example15_1.sce b/46/CH15/EX15.1/Example15_1.sce new file mode 100755 index 000000000..e927db95e --- /dev/null +++ b/46/CH15/EX15.1/Example15_1.sce @@ -0,0 +1,13 @@ +//Example 15.1
+clc
+s=%s;
+syms K;
+N=1;
+D=poly([-1 -2 -3],'s','roots');
+G=syslin('c',N/D);
+disp(K*G,'G=')
+evans(G)
+v=[-3.5 3.5 -6 6];
+mtlb_axis(v);
+xgrid
+
diff --git a/46/CH15/EX15.1/figure15_1.jpg b/46/CH15/EX15.1/figure15_1.jpg Binary files differnew file mode 100755 index 000000000..121688b29 --- /dev/null +++ b/46/CH15/EX15.1/figure15_1.jpg diff --git a/46/CH15/EX15.2/Example15_2.sce b/46/CH15/EX15.2/Example15_2.sce new file mode 100755 index 000000000..55d6b37e0 --- /dev/null +++ b/46/CH15/EX15.2/Example15_2.sce @@ -0,0 +1,14 @@ +//Example 15.2
+clc
+s=%s;
+syms Kc;
+N=1+(2*s/3)+1/(3*s);
+D=(20*s+1)*(10*s+1)*(0.5*s+1);
+G=N/D;
+G=syslin('c',G);
+disp(Kc*G,'G=')
+clf
+evans(G)
+v=[-2.5 1 -5 5];
+mtlb_axis(v);
+xgrid
\ No newline at end of file diff --git a/46/CH15/EX15.2/figure15_2.jpg b/46/CH15/EX15.2/figure15_2.jpg Binary files differnew file mode 100755 index 000000000..faa7f45b3 --- /dev/null +++ b/46/CH15/EX15.2/figure15_2.jpg diff --git a/46/CH16/EX16.1/Example16_1.sce b/46/CH16/EX16.1/Example16_1.sce new file mode 100755 index 000000000..fc4d8ddd7 --- /dev/null +++ b/46/CH16/EX16.1/Example16_1.sce @@ -0,0 +1,14 @@ +//Example 16.1
+clc
+s=%s;
+j=%i;
+f=10/%pi;
+w=2*%pi*f;
+G=1/(0.1*s+1);
+s=w*j;
+Gs=horner(G,s);
+disp(Gs,'G(20j)=')
+[r,theta]=polar(Gs)
+theta=theta*180/%pi;
+disp('degrees',theta,'theta=')
+
diff --git a/46/CH16/EX16.2/Example16_2.sce b/46/CH16/EX16.2/Example16_2.sce new file mode 100755 index 000000000..5dcd03dbb --- /dev/null +++ b/46/CH16/EX16.2/Example16_2.sce @@ -0,0 +1,16 @@ +//Example 16.2
+clc
+syms tau s zeta w;
+j=%i;
+n=1;
+d=tau^2*s^2+2*zeta*tau*s+1;
+G=n/d
+s=j*w;
+G=1/(2*s*tau*zeta+s^2*tau^2+1)
+[num den]=numden(G)
+d=abs(den)
+cof_a_0=coeffs(den,'%i',0)
+cof_a_1=coeffs(den,'%i',1)
+AR=1/d
+theta=AR*atan(-cof_a_1/cof_a_0);
+disp(theta,'Phase angle=')
\ No newline at end of file diff --git a/46/CH16/EX16.4/Example16_4.sce b/46/CH16/EX16.4/Example16_4.sce new file mode 100755 index 000000000..d4f104071 --- /dev/null +++ b/46/CH16/EX16.4/Example16_4.sce @@ -0,0 +1,12 @@ +//Example 16.4 +clc +s=%s; +H=1/(s+1); +Hs=syslin('c',H) +J=1/(s+5); +Js=syslin('c',J) +G=Hs*Js; +Gs=syslin('c',G) +clf +bode([Hs;Js;Gs;]) +legend(['1/(s+1)';'1/(s/5+1)';'1/(5*(s+1)*(s/5+1))']) diff --git a/46/CH16/EX16.4/figure16_4.jpg b/46/CH16/EX16.4/figure16_4.jpg Binary files differnew file mode 100755 index 000000000..2b7cf5a80 --- /dev/null +++ b/46/CH16/EX16.4/figure16_4.jpg diff --git a/46/CH16/EX16.5/Example16_5.sce b/46/CH16/EX16.5/Example16_5.sce new file mode 100755 index 000000000..d9e951dce --- /dev/null +++ b/46/CH16/EX16.5/Example16_5.sce @@ -0,0 +1,9 @@ +//Example 16.5 +clc +s=poly(0,'s'); +disp("G=10*(0.5*s+1)*exp(-s/10)/(((s+1)^2)*(0.1*s+1))") +printf("exp(-0.1*s)=(2-0.1*s)/(2+0.1*s)\n)") +G=10*(0.5*s+1)*(2-0.1*s)/(((s+1)^2)*(0.1*s+1)*(2+0.1*s)); +Gs=syslin('c',G) +clf +bode(Gs) diff --git a/46/CH16/EX16.5/figure16_5.jpg b/46/CH16/EX16.5/figure16_5.jpg Binary files differnew file mode 100755 index 000000000..7388a021a --- /dev/null +++ b/46/CH16/EX16.5/figure16_5.jpg diff --git a/46/CH17/EX17.1/Example17_1.sce b/46/CH17/EX17.1/Example17_1.sce new file mode 100755 index 000000000..b649134cf --- /dev/null +++ b/46/CH17/EX17.1/Example17_1.sce @@ -0,0 +1,27 @@ +//Example 17.1 +clc +s=%s; +syms Kc +tau=1; +taum=1; +wC=1; +g1=Kc; +g2=1/(s+1); +g3=1/(s+1); +G1=g2*g3; +G1=syslin('c',G1) +G=g1*g2/.g3; +disp(G,'C(s)/R(s)=') +//This equation can be written in the form of Kc*(s+1)/((1+Kc)*(tau2^2*s^2+2*tau2*zeta2*s+1) +tau2=sqrt(1/(1+Kc)) +zeta2=sqrt(1/(1+Kc)) +clf +bode(G1) +show_margins(G1) +//To make the open loop gain 1 at w=4 +phaseangle=-152//degrees +phasemargin=180+phaseangle//degrees +//At this phase margin, the gain margin is +A=0.062//gain margin +Kc=1/A +zeta2=dbl(zeta2) diff --git a/46/CH17/EX17.1/figure17_1.jpg b/46/CH17/EX17.1/figure17_1.jpg Binary files differnew file mode 100755 index 000000000..642c9b62f --- /dev/null +++ b/46/CH17/EX17.1/figure17_1.jpg diff --git a/46/CH17/EX17.3/Example17_3.sce b/46/CH17/EX17.3/Example17_3.sce new file mode 100755 index 000000000..aa966f96e --- /dev/null +++ b/46/CH17/EX17.3/Example17_3.sce @@ -0,0 +1,17 @@ +//Example 17.3 +clc; +syms Kc tauI s; +g1=Kc*(1+1/(tauI*s)); +g2=1/(s+1); +g2=exp(-1.02*s) +G=g1*g2*g3//Openloop transfer function +//By solving the equation -180=-atan(w)-57.3*1.02*w, we get +wc0=2;//rad/min +disp('AR=Kcu/sqrt(1+wc0^2)') +AR=1; +Kcu=AR*sqrt(1+wc0^2); +//From Ziegler-Nicholas rules +Kc=Kcu*0.45//ultimate gain +Pu=2*%pi/wc0;//ultimate period +tauI=Pu/1.2; +disp('min',tauI,'tauI=')
\ No newline at end of file diff --git a/46/CH17/EX17.4/Example17_4.sce b/46/CH17/EX17.4/Example17_4.sce new file mode 100755 index 000000000..1a2e58d94 --- /dev/null +++ b/46/CH17/EX17.4/Example17_4.sce @@ -0,0 +1,41 @@ +//Example 17.4
+clc
+s=%s;
+syms Kc K1 tauI tauD
+K=0.09;
+Kc=K1/K;
+Gc=K1*(1+1/(tauI*s)+tauD*s)
+g1=1/((s+1)*(s+2));
+//g2=exp(-0.5*s), we can write it as g2=(2-0.5*s)/(2+0.5*s). Therefore,
+g2=(2-0.5*s)/(2+0.5*s);
+G=g1*g2;
+G=syslin('c',G)
+clf
+bode(G)
+show_margins(G)
+//From the bode diagrams we get
+wc0=1.56;//rad/min
+A=0.145;
+Ku=1/A
+Pu=2*%pi/wc0
+//By Z-N rules
+//For P controller
+K1=0.5*Ku
+Gc=K1
+G1=Gc*G/K1
+//For PI controller
+K1=0.45*Ku
+tauI=Pu/1.2
+Gc=K1*(1+1/(tauI*s))
+G2=Gc*G/K1
+//For PID controller
+K1=0.6*Ku
+tauI=Pu/2
+tauD=Pu/8
+Gc=K1*(1+1/(tauI*s)+tauD*s)
+G3=Gc*G/K1
+clf
+bode([G1;G2;G3])
+legend(['G1';'G2';'G3']);
+
+
diff --git a/46/CH17/EX17.4/figure17_4a.jpg b/46/CH17/EX17.4/figure17_4a.jpg Binary files differnew file mode 100755 index 000000000..f416d1dc9 --- /dev/null +++ b/46/CH17/EX17.4/figure17_4a.jpg diff --git a/46/CH17/EX17.4/figure17_4b.jpg b/46/CH17/EX17.4/figure17_4b.jpg Binary files differnew file mode 100755 index 000000000..6dbafe2d3 --- /dev/null +++ b/46/CH17/EX17.4/figure17_4b.jpg diff --git a/46/CH18/EX18.3/Example18_3.sce b/46/CH18/EX18.3/Example18_3.sce new file mode 100755 index 000000000..ff0e6c006 --- /dev/null +++ b/46/CH18/EX18.3/Example18_3.sce @@ -0,0 +1,10 @@ +//Example 18.3
+clc
+s=%s;
+Kf=-1;
+tp=2;
+//Applying feedforward control rules
+T1=1.5*tp
+T2=0.7*tp
+Gfs=Kf*(T1*s+1)/(T2*s+1);
+disp(Gfs,'Gf(s)=')
diff --git a/46/CH18/EX18.5/Example18_5.sce b/46/CH18/EX18.5/Example18_5.sce new file mode 100755 index 000000000..9067b8fba --- /dev/null +++ b/46/CH18/EX18.5/Example18_5.sce @@ -0,0 +1,17 @@ +//Example 18.5
+clc
+syms K tau s l;
+Gm=K/(tau*s+1);
+//For this case
+Gma=1;
+Gmm=K/(tau*s+1);
+Gm=Gma*Gmm;
+GI=1/Gmm
+f=1/(l*s+1);
+//In order to be able to implement this transfer function let f(s)=1/(l*s+1)
+//Thus IMC becomes
+GI=f/Gmm
+Gc=GI/(1-GI*Gm)
+//On simplification, it will be in the form of
+Gc=tau*(1+1/(tau*s))/(l*s*K)
+printf("The result is in the form of PI controller")
\ No newline at end of file diff --git a/46/CH18/EX18.6/Example18_6.sce b/46/CH18/EX18.6/Example18_6.sce new file mode 100755 index 000000000..663248075 --- /dev/null +++ b/46/CH18/EX18.6/Example18_6.sce @@ -0,0 +1,22 @@ +//Example
+clc
+syms K taud s tau t
+G=K*exp(-taud*s)/(tau*s+1)
+//we can use an approximation that
+printf("exp(-taud*s)=(2-taud*s/2)/(2+taud*s)\n")
+Gm=K*(2-taud*s/2)/((2+taud*s)*(tau*s+1));//here Gm=G
+//For this model
+Gma=(2-taud*s/2)/(2+taud*s);
+Gmm=K/(tau*s+1);
+Gm=Gma*Gmm;
+GI=1/Gmm
+f=1/(l*s+1);
+//In order to be able to implement this transfer function let f(s)=1/(l*s+1)
+//Thus IMC becomes
+GI=f/Gmm
+Gc=GI/(1-GI*Gm)
+//This may be reduced algebraically to the form given by Eq.(18.21) with
+printf("Kc=(2*tau+taud)/(2*l+taud)\n")
+printf("tauI=tau+taud/2\n")
+printf("tau*taud)/(2*tau+taud)\n")
+printf("tau1=l*taud/2*(l+taud)\n")
diff --git a/46/CH19/EX19.1/Example19_1.sce b/46/CH19/EX19.1/Example19_1.sce new file mode 100755 index 000000000..2a0724ab2 --- /dev/null +++ b/46/CH19/EX19.1/Example19_1.sce @@ -0,0 +1,32 @@ +//Example 19.1
+clc
+s=poly(0,'s');
+syms tauI Kc
+Gc=1+1/(tauI*s);
+g1=1/(s+1);
+//g2=exp(-s);
+//we can write exp(-s) as (2-s)/(2+s).Therefore,
+g2=(2-s)/(2+s);
+G=g1*g2;
+G=syslin('c',G)
+Gp=Kc*Gc*G
+Gs=Gp/(1+Gp)//Overall transfer function
+//Ziegler Nicholas method
+scf(1);
+clf
+bode(G)
+show_margins(G)
+//From bode diagrams we get
+wc0=2.03
+Kcu=2.26
+Pu=2*%pi/wc0
+//Since Gc is a PI controller, by Z-N rules
+Kc=0.45*Kcu
+tauI=Pu/1.2
+//Cohen-Coon method
+//Comaparing G with Eq.(19.6), we get
+T=1;
+Td=1;
+Kp=1;
+Kc=T*(0.9+Td/(12*T))/(Kp*Td)
+tauI=Td*(30+3*Td/T)/(9+20*Td/T)
diff --git a/46/CH19/EX19.1/figure19_1.jpg b/46/CH19/EX19.1/figure19_1.jpg Binary files differnew file mode 100755 index 000000000..a64bd748e --- /dev/null +++ b/46/CH19/EX19.1/figure19_1.jpg diff --git a/46/CH19/EX19.2/Example19_2.sce b/46/CH19/EX19.2/Example19_2.sce new file mode 100755 index 000000000..126b65204 --- /dev/null +++ b/46/CH19/EX19.2/Example19_2.sce @@ -0,0 +1,47 @@ +//Example 19.2
+clc
+s=%s;
+syms t Kc tauI;
+Gc=Kc*(1+1/(tauI*s))
+G=1/(s+1)^4;
+G=syslin('c',G)
+Gs=Gc*G/(1+Gc*G)//Overall transfer function
+Us=1/s;
+Cs=G*Us;
+//Cohen-Coon method
+Ct=ilaplace(Cs,s,t)
+Ct1=diff(Ct,t)
+Ct2=diff(Ct1,t)
+disp('=0',Ct2)
+//On solving the equation we get
+t=linsolve(-1,3)
+S=dbl(Ct1)
+C3=dbl(Ct)
+//From the figure 19.10 (B Vs t)
+y2=0.353;
+y1=0;
+x2=3;
+Td=3-(y2-y1)/S
+Bu=1;//ultimate value of B
+//From Eq.(19.4)
+T=Bu/S
+Kp=1;
+//From Table 19.2
+Kc=T*(0.9+Td/(12*T))/(Kp*Td)
+tauI=Td*(30+3*Td/T)/(9+20*Td/T)
+//By Z-N method
+clf
+bode(G)
+show_margins(G)
+//From Bode diagrams we get
+Kcu=4;
+Pu=2*%pi;
+//Since Gc is a PI controller, by Z-N rules
+Kc=0.45*Kcu
+tauI=Pu/1.2
+//By fitting the process reaction curve to a first order wit transport lag model by means of a least square fitting procedure. Applying the least square fit procedure out to t=5 produced the following results
+Td=1.5;
+T=3;
+//By applying Cohen-Coon rules, we get
+Kc=T*(0.9+Td/(12*T))/(Kp*Td)
+tauI=Td*(30+3*Td/T)/(9+20*Td/T)
diff --git a/46/CH19/EX19.2/figure19_2.jpg b/46/CH19/EX19.2/figure19_2.jpg Binary files differnew file mode 100755 index 000000000..366297af9 --- /dev/null +++ b/46/CH19/EX19.2/figure19_2.jpg diff --git a/46/CH2/EX2.1/Example2_1.sce b/46/CH2/EX2.1/Example2_1.sce new file mode 100755 index 000000000..6b24ada8d --- /dev/null +++ b/46/CH2/EX2.1/Example2_1.sce @@ -0,0 +1,5 @@ +//Example 2.1
+syms t s;
+fs=laplace('1',t,s);
+disp(fs,'f(s)=')
+
diff --git a/46/CH2/EX2.3/Example2_3.sce b/46/CH2/EX2.3/Example2_3.sce new file mode 100755 index 000000000..f6a27ffea --- /dev/null +++ b/46/CH2/EX2.3/Example2_3.sce @@ -0,0 +1,8 @@ +//Example 2.3
+clc
+s=%s;
+xs=2/(s+3);
+disp(xs,'x(s)=')
+syms t;
+xt=ilaplace(xs,s,t);
+disp(xt,'x(t)=')
diff --git a/46/CH20/EX20.1/Example20_1.sce b/46/CH20/EX20.1/Example20_1.sce new file mode 100755 index 000000000..980f81868 --- /dev/null +++ b/46/CH20/EX20.1/Example20_1.sce @@ -0,0 +1,7 @@ +//Example 20.1 +clc +Cv=4; +G=1.26; +P=100;//psi +q=Cv*sqrt(P/G); +disp('gpm',q,'q=') diff --git a/46/CH20/EX20.2/Example20_2.sce b/46/CH20/EX20.2/Example20_2.sce new file mode 100755 index 000000000..d57275982 --- /dev/null +++ b/46/CH20/EX20.2/Example20_2.sce @@ -0,0 +1,27 @@ +//Example 20.2 +clc +L=100;//ft +D=1;//ft +D1=D/12;//inches +D2=D1*2.42;//centimetres +rho=62.4;//lb/ft^3 +mu=1.5;//cp +Cv=4; +pv=100;//psi +G=1; +q=Cv*sqrt(pv/G);//maximum flow +disp('gpm',q,'q=') +printf("Let us start flow from q=30 gpm\n") +q=30;//gpm +q1=q/(60*7.48);//ft^3/sec +q2=q1*60*60;//ft^3/hr +Re=4*q2*rho/(%pi*mu*D2)//Reynolds number +//For this value of Reynolds number and for smooth pipe fanning friction factor is 0.005 +f=0.005;//fanning friction factor +gc=32.2; +p=32*f*L*rho*q1^2/(144*%pi^2*gc*D1^5);//psi +P=pv-p +qmax=Cv*sqrt(P/G); +disp('gpm',qmax,'qmax=') +x=q/qmax//lift + diff --git a/46/CH20/EX20.3/Example20_3.sce b/46/CH20/EX20.3/Example20_3.sce new file mode 100755 index 000000000..e0525bf49 --- /dev/null +++ b/46/CH20/EX20.3/Example20_3.sce @@ -0,0 +1,30 @@ +//Example 20.3 +clc +L=200;//ft +D=1;//ft +D1=D/12;//inches +D2=D1*2.42;//centimetres +rho=62.4;//lb/ft^3 +mu=1.5;//cp +pv=100;//psi +G=1; +q=30;//maximum flow +disp('gpm',30,'q=') +q1=q/(60*7.48);//ft^3/sec +q2=q1*60*60;//ft^3/hr +Re=4*q2*rho/(%pi*mu*D2)//Reynolds number +//For this value of Reynolds number and for smooth pipe fanning friction factor is 0.005 +f=0.005;//fanning friction factor +gc=32.2; +p=32*f*L*rho*q1^2/(144*%pi^2*gc*D1^5);//psi +P=pv-p +Cv=q/sqrt(P/G) +//For q=20 +q=20;//gpm +q1=q/(60*7.48);//ft^3/sec +p=32*f*L*rho*q1^2/(144*%pi^2*gc*D1^5);//psi +P=pv-p +qmax=Cv*sqrt(P/G); +disp('gpm',qmax,'qmax=') +x=q/qmax//lift + diff --git a/46/CH22/EX22.1/Example22_1.sce b/46/CH22/EX22.1/Example22_1.sce new file mode 100755 index 000000000..37d76c1e6 --- /dev/null +++ b/46/CH22/EX22.1/Example22_1.sce @@ -0,0 +1,7 @@ +//Example 22.1
+clc
+disp("f(t)=u(t)=1")
+disp("f(nT)=1")//for n>=0
+syms z n
+//From Eq.(22.8)
+Z=symsum(z^(-n),n,0,%inf)
\ No newline at end of file diff --git a/46/CH22/EX22.2/Example22_2.sce b/46/CH22/EX22.2/Example22_2.sce new file mode 100755 index 000000000..52a091137 --- /dev/null +++ b/46/CH22/EX22.2/Example22_2.sce @@ -0,0 +1,7 @@ +//Example 22.2
+clc
+syms T tau z n
+disp("f(t)=exp(-t/tau)")
+ft=exp(-n*T/tau)*z^(-n);
+Z=symsum(ft,n,0,%inf)
+
diff --git a/46/CH24/EX24.1/Example24_1.sce b/46/CH24/EX24.1/Example24_1.sce new file mode 100755 index 000000000..ef339d7e0 --- /dev/null +++ b/46/CH24/EX24.1/Example24_1.sce @@ -0,0 +1,19 @@ +//Example 24.1
+clc
+syms K b z w;
+Gz=K*(1-b)/(z-b)
+//where b=exp(-T/tau)
+//From Eq.(24.4)
+z=w+1/w-1;
+Gz=eval(Gz)
+disp('=0',1+Gz,'1+G(z)=')
+//which is equivalent to
+disp('(K+1)*(1-b)*w+(1+b)-K(1-b)=0')
+routh=[(K+1)*(1-b);(1+b)-K*(1-b)]
+//b is always positive and less than one and K is positive
+//The first element in the array is positive
+//For stability, the Routh test requires that all elements of the first column be positive
+//Therefore,
+disp('>0',routh(2,1))
+disp('K<(1+b)/(1-b)')
+
diff --git a/46/CH26/EX26.1.a/Example26_1a.sce b/46/CH26/EX26.1.a/Example26_1a.sce new file mode 100755 index 000000000..c8f7cecd4 --- /dev/null +++ b/46/CH26/EX26.1.a/Example26_1a.sce @@ -0,0 +1,14 @@ +//Example 26.1(a) +clc +T=1; +tau=1.25; +b=exp(-T/tau) +//For quarter decay ratio +alpha=0.5 +K=(alpha+b)/(1-b) +//Ultimate value of C is +Ci=K/(K+1); +disp(Ci,'C(inf)=') +Ri=1; +Offset=Ri-Ci +Period=2*T diff --git a/46/CH26/EX26.1.b/Example26_2b.sce b/46/CH26/EX26.1.b/Example26_2b.sce new file mode 100755 index 000000000..22b82525a --- /dev/null +++ b/46/CH26/EX26.1.b/Example26_2b.sce @@ -0,0 +1,14 @@ +//Example 26.1(a) +clc +T=0.5; +tau=1.25; +b=exp(-T/tau) +//For quarter decay ratio +alpha=0.5 +K=(alpha+b)/(1-b) +//Ultimate value of C is +Ci=K/(K+1); +disp(Ci,'C(inf)=') +Ri=1; +Offset=Ri-Ci +Period=2*T diff --git a/46/CH29/EX29.1/Example29_1.sce b/46/CH29/EX29.1/Example29_1.sce new file mode 100755 index 000000000..14ab3d8b2 --- /dev/null +++ b/46/CH29/EX29.1/Example29_1.sce @@ -0,0 +1,14 @@ +//Example 29.1
+clc
+syms t tau
+A=[-1 1;0 -2]
+B=[0;1]
+x0=[-1;0]
+printf("x1=Ax+Bu(t)")
+//On solving given equation
+//let X=exp(A*t)
+X=[exp(-t) exp(-t)-exp(-2*t);0 exp(-2*t)]
+//Y=exp(A*(t-tau))
+Y=[exp(-(t-tau) ) exp(-(t-tau))-exp(-2*(t-tau));0 exp(-2*(t-tau))]
+//From Eq.(29.4)
+xt=X*x0+integ(Y*B,tau,0,t)
\ No newline at end of file diff --git a/46/CH29/EX29.2/Example29_2.sce b/46/CH29/EX29.2/Example29_2.sce new file mode 100755 index 000000000..04e6796a9 --- /dev/null +++ b/46/CH29/EX29.2/Example29_2.sce @@ -0,0 +1,20 @@ +//Example 29.2
+clc
+A=[-2 0;4 -3]
+B=[1 0;0 2]
+syms s H1s H2s U1s U2s
+I=eye(2,2)
+Gs=inv(s*I-A)*B
+Hs=[H1s;H2s]
+Us=[U1s;U2s]
+Hs=Gs*Us
+//On comparing
+H1s=Hs(1,1)
+H2s=Hs(2,1)
+U2s=0;
+U1s=1/s;
+H1s=eval(H1s)
+H2s=eval(H2s)
+//On inverse laplace transformations
+H1t=ilaplace(H1s,s,t)
+H2s=ilaplace(H2s,s,t)
diff --git a/46/CH3/EX3.1/Example3_1.sce b/46/CH3/EX3.1/Example3_1.sce new file mode 100755 index 000000000..5e93b70b1 --- /dev/null +++ b/46/CH3/EX3.1/Example3_1.sce @@ -0,0 +1,11 @@ +//Example 3.1
+clc
+s=%s;
+xs=1/(s*(s+1));
+disp(xs,'x(s)=')
+syms t;
+[A]=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+xt=F1+F2;
+disp(xt,'x(t)=')
diff --git a/46/CH3/EX3.2/Example3_2.sce b/46/CH3/EX3.2/Example3_2.sce new file mode 100755 index 000000000..acda68807 --- /dev/null +++ b/46/CH3/EX3.2/Example3_2.sce @@ -0,0 +1,16 @@ +//Example 3.2
+clc
+s=%s;
+syms t;
+num=poly([-8 9 -6 0 1],'s','coeff');
+den=s*(s-2)*poly([-2 -1 2 1],'s','coeff');
+xs=syslin('c',num/den);
+disp(xs,'x(s)=')
+A=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+F3=ilaplace(A(3),s,t);
+F4=ilaplace(A(4),s,t);
+F5=ilaplace(A(5),s,t);
+xt=F1+F2+F3+F4+F5;
+disp(xt,'x(t)=')
diff --git a/46/CH3/EX3.3/Example3_3.sce b/46/CH3/EX3.3/Example3_3.sce new file mode 100755 index 000000000..7f1a273ab --- /dev/null +++ b/46/CH3/EX3.3/Example3_3.sce @@ -0,0 +1,11 @@ +//Example 3.3
+clc
+s=%s;
+syms t;
+xs=2/(s*(s^2+2*s+2));
+disp(xs,'x(s)=')
+[A]=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+xt=F1+F2;
+disp(xt,'x(t)=')
diff --git a/46/CH3/EX3.4/Example3_4.sce b/46/CH3/EX3.4/Example3_4.sce new file mode 100755 index 000000000..78ce8c22c --- /dev/null +++ b/46/CH3/EX3.4/Example3_4.sce @@ -0,0 +1,11 @@ +//Example 3.4
+clc
+s=%s;
+syms t;
+xs=2/((s^2+4)*(s+1));
+disp(xs,'x(s)=')
+[A]=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+xt=F1+F2;
+disp(xt,'x(t)=')
\ No newline at end of file diff --git a/46/CH3/EX3.5/Example3_5.sce b/46/CH3/EX3.5/Example3_5.sce new file mode 100755 index 000000000..b65e49736 --- /dev/null +++ b/46/CH3/EX3.5/Example3_5.sce @@ -0,0 +1,11 @@ +//Example 3.5
+clc
+s=%s;
+syms t;
+xs=1/(s*(s^2-2*s+5));
+disp(xs,'x(s)=')
+[A]=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+xt=F1+F2;
+disp(xt,'x(t)=')
\ No newline at end of file diff --git a/46/CH3/EX3.6/Example3_6.sce b/46/CH3/EX3.6/Example3_6.sce new file mode 100755 index 000000000..a841414de --- /dev/null +++ b/46/CH3/EX3.6/Example3_6.sce @@ -0,0 +1,12 @@ +//Example 3.6
+clc
+s=%s;
+syms t;
+xs=1/(s*(s^3+3*s^2+3*s+1));
+disp(xs,'x(s)=')
+[A]=pfss(xs)
+F1=ilaplace(A(1),s,t);
+F2=ilaplace(A(2),s,t);
+xt=F1+F2;
+disp(xt,'x(t)=')
+
diff --git a/46/CH30/EX30.1/Example30_1.sce b/46/CH30/EX30.1/Example30_1.sce new file mode 100755 index 000000000..04d59a57e --- /dev/null +++ b/46/CH30/EX30.1/Example30_1.sce @@ -0,0 +1,24 @@ +//Example 30.1
+clc
+A1=1;
+A2=1/2;
+R1=1/2;
+R2=2;
+R3=1;
+A=[-1/(R1*A1)-1/(R3*A1) 1/(A1*R1);1/(R1*A2) -1/(R2*A2)-1/(A2*R1)]
+B=[1/A1 0;0 1/A2]
+syms s M1 M2;
+I=eye(2,2)
+Gp=inv(s*I-A)*B
+G11=Gp(1,1)
+G12=Gp(1,2)
+G21=Gp(2,1)
+G22=Gp(2,2)
+M=[M1;M2]
+Cs=inv(s*I-A)*B*M
+M1=1/s;
+M2=0;
+Cs=eval(Cs)
+M1=0;
+M2=1/s;
+Cs=eval(Cs)
\ No newline at end of file diff --git a/46/CH30/EX30.2/Example30_2.sce b/46/CH30/EX30.2/Example30_2.sce new file mode 100755 index 000000000..216f176ef --- /dev/null +++ b/46/CH30/EX30.2/Example30_2.sce @@ -0,0 +1,26 @@ +//Example 30.2
+clc
+syms s K1 K2
+Gc11=K1;
+Gc22=K2;
+A1=1;
+A2=1/2;
+R2=2;
+R3=1;
+//In this problem ,Gv is a unit diagonal matrix i.e.,
+Gv1=1;
+Gv2=1;
+A=[-1/(R1*A1)-1/(R3*A1) 1/(A1*R1);1/(R1*A2) -1/(R2*A2)-1/(A2*R1)]
+B=[1/A1 0;0 1/A2]
+I=eye(2,2)
+Gp=inv(s*I-A)*B
+G11=Gp(1,1)
+G12=Gp(1,2)
+G21=Gp(2,1)
+G22=Gp(2,2)
+Gc12=-G12*Gv2*Gc22/(G11*Gv1)
+Gc21=-G21*Gv1*Gc11/(G22*Gv2)
+Gv=[Gv1 0;0 Gv2]
+Gc=[Gc11 Gc12;Gc21 Gc22]
+Go=Gp*Gv*Gc;
+Go=simple(Go)
\ No newline at end of file diff --git a/46/CH30/EX30.3/Example30_3.sce b/46/CH30/EX30.3/Example30_3.sce new file mode 100755 index 000000000..77fc98570 --- /dev/null +++ b/46/CH30/EX30.3/Example30_3.sce @@ -0,0 +1,31 @@ +//Example 30.3
+clc
+A1=1;
+A2=1/2;
+R1=1/2;
+R2=2;
+R3=1;
+Gc11=K1;
+Gc22=K2;
+Gc12=0;
+Gc21=0;
+A=[-1/(R1*A1)-1/(R3*A1) 1/(A1*R1);1/(R1*A2) -1/(R2*A2)-1/(A2*R1)]
+B=[1/A1 0;0 1/A2]
+syms s;
+I=eye(2,2)
+Gp=inv(s*I-A)*B
+G11=Gp(1,1)
+G12=Gp(1,2)
+G21=Gp(2,1)
+G22=Gp(2,2)
+Gv1=1;
+Gv2=1;
+Gm=I
+Gv=[Gv1 0;0 Gv2]
+Gc=[Gc11 Gc12;Gc21 Gc22]
+Go=Gp*Gv*Gc;
+Go=simple(Go)
+//From Eq.(30.32)
+P=det(I+Go*Gm)
+disp('=0',simple(P))
+
diff --git a/46/CH4/EX4.1/Example4_1.sce b/46/CH4/EX4.1/Example4_1.sce new file mode 100755 index 000000000..68cec8dfb --- /dev/null +++ b/46/CH4/EX4.1/Example4_1.sce @@ -0,0 +1,10 @@ +//Example 4.1
+clc
+s=%s;
+num=poly(1,'s','coeff');
+den=s*poly([1 3 3 1],'s','coeff');
+xs=num/den;
+disp(xs,'xs=')
+syms s;
+xt=limit(s*xs,s,0);//final value theorem
+disp(xt,'x(t)=')
\ No newline at end of file diff --git a/46/CH4/EX4.2/Example4_2.sce b/46/CH4/EX4.2/Example4_2.sce new file mode 100755 index 000000000..94ce2e3c0 --- /dev/null +++ b/46/CH4/EX4.2/Example4_2.sce @@ -0,0 +1,12 @@ +//Example 4.2
+clc
+s=%s;
+num=poly([-8 0 9 -6 1],'s','coeff');
+den=s*(s-2)*poly([-2 -1 2 1],'s','coeff')
+xs=num/den;
+disp(xs,'x(s)=')
+disp(s*xs,'s*x(s)=')
+[A]=pfss(s*xs)
+printf("since xs becomes infinite for s=1 and s=2, the conditions of the final value theorem are not satisfied\n")
+printf("Final value theorem is not applicable \n")
+
diff --git a/46/CH4/EX4.4/Example4_4.sce b/46/CH4/EX4.4/Example4_4.sce new file mode 100755 index 000000000..4b675b8f7 --- /dev/null +++ b/46/CH4/EX4.4/Example4_4.sce @@ -0,0 +1,8 @@ +//Example 4.4
+clc
+syms t s a k;
+xt=laplace('%e^(-a*t)*cos(k*t)',t,s);
+disp(xt,'x(t)=')
+x
+
+
diff --git a/46/CH5/EX5.1/Example5_1.sce b/46/CH5/EX5.1/Example5_1.sce new file mode 100755 index 000000000..5f5368ba0 --- /dev/null +++ b/46/CH5/EX5.1/Example5_1.sce @@ -0,0 +1,9 @@ +//Example 5.1
+tau=0.1;//min
+xs=90;//degrees
+A=10;//degrees
+Y_inf=10;//degrees
+Y_t=8;//degrees
+//Substituting into Eq.(5.12) the appropriate values of Y_t,A,and tau gives
+t=-0.1*logm(1-(Y_t/A));//min
+disp('min',t,'time=')
\ No newline at end of file diff --git a/46/CH5/EX5.2/Example5_2.sce b/46/CH5/EX5.2/Example5_2.sce new file mode 100755 index 000000000..475584914 --- /dev/null +++ b/46/CH5/EX5.2/Example5_2.sce @@ -0,0 +1,35 @@ +//Example 5.2
+clear
+clc
+tau=0.1;//min
+xs=100;//Fahrenheit
+ys=100;//Fahrenheit
+A=2;//Fahrenheit
+f=10/%pi;//cycles/min
+w=2*%pi*f;//rad/min
+//From Eq.(5.25), the amplitude of the response and the phase angle are calculated;thus
+disp('Fahrenheit',A/sqrt((tau*w)^2+1),'A/sqrt((tau*w)^2+1)=')
+phi=atan(-w*tau);//radians
+phi=phi*180/%pi;//degrees
+disp('degrees',phi,'phase lag=')
+t=0:0.01:1;
+//From Eq.(5.19), the input of the thermometer is therefore
+disp("X(t)=2*sin(20*t)");
+//or
+xt=xs+2*sin(20*t);
+//The response of the thermometer is therefore
+disp("Y(t)=0.8944*sin(20*t-63.4349)")
+//or
+yt=ys+0.8944*sin(20*t-63.4349);
+Lag=phi/(360*f);//min
+Lag=abs(Lag);//min
+disp('min',Lag,'Lag=')
+clf;
+plot(t,yt)
+plot(t,xt)
+xlabel('time')
+ylabel('x(t) , y(t)')
+title('x(t) , y(t) Vs time')
+xgrid
+
+
diff --git a/46/CH5/EX5.2/figure5_2.jpg b/46/CH5/EX5.2/figure5_2.jpg Binary files differnew file mode 100755 index 000000000..a8b463c04 --- /dev/null +++ b/46/CH5/EX5.2/figure5_2.jpg diff --git a/46/CH6/EX6.1/Example6_1.sce b/46/CH6/EX6.1/Example6_1.sce new file mode 100755 index 000000000..cc04a958a --- /dev/null +++ b/46/CH6/EX6.1/Example6_1.sce @@ -0,0 +1,26 @@ +//Example 6.1
+clc;
+syms s t;
+tau=1;//min
+R=1/9;//ft/cfm
+A=9;
+//from Equation 6.8
+g=R/(tau*s+1);
+disp(g,'H(s)/Q(s)=')
+//from Example 4.5
+disp('Q(t)=90[u(t)-u(t-0.1)')
+//where u(t) is a unit step function, the laplace transform of it gives
+Qs=90*(1-exp(-0.1*s))/s
+disp(Qs,'Q(s)=')
+Hs=Qs*g;
+disp(Hs,'H(s)=')
+//taking first term for t<0.1, the second term goes equals to zero
+Ht=ilaplace('10*(1/(s*(s+1)))',s,t);//t<0.1
+disp(Ht,'H(t)=')
+disp('H(t)=10(1-yexp(-(-t-0.1)))')//t>0.1
+Ht=10*((1-exp(-t))-(1-exp(-(-t-0.1))));
+disp(Ht,'H(t)=')
+//from Eq.(5.16)
+Ht=R*A*exp(-(t/tau));//impulse
+disp(Ht,'H(t)=')
+
diff --git a/46/CH7/EX7.1/Example7_1.sce b/46/CH7/EX7.1/Example7_1.sce new file mode 100755 index 000000000..088c1ca88 --- /dev/null +++ b/46/CH7/EX7.1/Example7_1.sce @@ -0,0 +1,15 @@ +//Example 7.1
+clc
+s=%s;
+tau1=0.5;
+tau2=1;
+R2=1;
+//From Eq.(7.8)
+g=R2/((tau1*s+1)*(tau2*s+1))
+disp(g,'H2(s)/Q(s)=')
+Qs=1/s;
+H2s=g*Qs;
+disp(H2s,'H2(s)=')
+syms t;
+H2t=ilaplace(H2s,s,t);
+disp(H2t,'H2(t)=')
\ No newline at end of file |