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 /1151 | |
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 '1151')
164 files changed, 2109 insertions, 0 deletions
diff --git a/1151/CH1/EX1.1/example1.sce b/1151/CH1/EX1.1/example1.sce new file mode 100755 index 000000000..e30b57367 --- /dev/null +++ b/1151/CH1/EX1.1/example1.sce @@ -0,0 +1,5 @@ +printf("\n trnsfer function of the given network ")
+printf("\n Vi(s)=R*I(s)+s*L*I(s)")
+printf("\n V0=s*L*I")
+printf("\n V0(s)/Vi(s)=s*L*I/(R*I(s)+s*L*I(s))")
+printf("V0(s)/Vi(s)=s*L/(R+s*L) is the required transfer function")
diff --git a/1151/CH1/EX1.10/example10.sce b/1151/CH1/EX1.10/example10.sce new file mode 100755 index 000000000..7dc11966d --- /dev/null +++ b/1151/CH1/EX1.10/example10.sce @@ -0,0 +1,4 @@ +//find out transfer function of the system
+
+printf("syms K1 K2 M1 M2 B12 fc1 fc2");printf(" the differential equations in laplace form are \n F(s)=X1(s)[s^2*M1+s*B12+s*fc1+K1]-B12*s*X2(s)")
+printf("\n X1(s)=X2(s)*(s^2*M2+B12*s+s*fc2+K2)/(B12*s)\nf=B12*s/((s^2*M2+B12*s+s*fc2+K2)*(s^2*M1+B12*s+s*fc1+K1)-s^2*B12);\n Transfer function X2(s)/F(s)=f")
diff --git a/1151/CH1/EX1.18/example18.sce b/1151/CH1/EX1.18/example18.sce new file mode 100755 index 000000000..4eb583a53 --- /dev/null +++ b/1151/CH1/EX1.18/example18.sce @@ -0,0 +1,5 @@ +//write down systems of equations and find F(s)/X2(s)
+
+
+printf(" the differential equatios are \n F(s)=s^2*M1**X1(s)+(K1+K2)*X2(s)-K2*X2(s)")
+printf("\n X1(s)=X2(s)*(s^2*M2+K3+K2)/K2\n f=((s^2*M1+K1+K2)*(s^2*M2+K2+K3)-K2^2)/K2\n Transfer function F(s)/X2(s)=f")
diff --git a/1151/CH1/EX1.19/example18.sce b/1151/CH1/EX1.19/example18.sce new file mode 100755 index 000000000..4eb583a53 --- /dev/null +++ b/1151/CH1/EX1.19/example18.sce @@ -0,0 +1,5 @@ +//write down systems of equations and find F(s)/X2(s)
+
+
+printf(" the differential equatios are \n F(s)=s^2*M1**X1(s)+(K1+K2)*X2(s)-K2*X2(s)")
+printf("\n X1(s)=X2(s)*(s^2*M2+K3+K2)/K2\n f=((s^2*M1+K1+K2)*(s^2*M2+K2+K3)-K2^2)/K2\n Transfer function F(s)/X2(s)=f")
diff --git a/1151/CH1/EX1.2/example2.sce b/1151/CH1/EX1.2/example2.sce new file mode 100755 index 000000000..a6b7aa52a --- /dev/null +++ b/1151/CH1/EX1.2/example2.sce @@ -0,0 +1,4 @@ +printf("\n trnsfer function of the given network ")
+printf("\n E0(s)=(1/(C*s))*I(s)")
+printf("\n E0(s/Ei(s)=(I(s)/C*s)*((C*s)/(I(s)*(s^2*LC+s*R*C+1)))")
+printf(" E0(s/Ei(s)= 1/(s^2*LC+s*R*C+1)is the required transfer function")
diff --git a/1151/CH1/EX1.20/example20.sce b/1151/CH1/EX1.20/example20.sce new file mode 100755 index 000000000..2eeb445a1 --- /dev/null +++ b/1151/CH1/EX1.20/example20.sce @@ -0,0 +1,29 @@ +printf(" given \n N1=300\n N2=50 \n w1=3 rad/sec\n Torque for wheel 1=10Nm \n displacement for wheel 1=3 radian(clockwise)\n angular accerleration of wheel 1 is 4 rad/sec^2 ")
+printf("find a) r1:r2 and r1:r3\n b)w3,w4 \n c)torque for wheel 2,wheel 3 \n displacement for wheel 2,3and 4\n e) angular displacement of wheel3 ")
+n1=300;
+n2=50;
+n3=150;
+n4=30;
+r=n1/n2;
+r1=n1/n3;
+disp(r,"r1:r2=");
+disp(r1,"r1:r3=")
+w1=15;
+w3=r1*w1; w4=n1*w1/n2;
+disp(w3,"w3=")
+disp(w4,"w4=")
+t1=10;
+t2=t1/r;
+t3=t1/r1;
+disp(t2,"torque for wheel 2 (in Nm) is")
+disp(t3,"torque for wheel 3(in Nm) is")
+disp(d2,"displacement for wheel 2 (in radian) is")
+
+d1=3;
+d2=r*d1;
+d3=d2*n2/n3;
+d4=d3*n3/n1;
+disp(d3,"displacement for wheel 3 (in radian) is")
+disp(d4,"displacement for wheel 4 (in radian) is")
+a=r1*4;
+disp(a,"angular displacement for wheel 3(in rad/sec^2) is")
diff --git a/1151/CH1/EX1.23/example23.sce b/1151/CH1/EX1.23/example23.sce new file mode 100755 index 000000000..1f9497c38 --- /dev/null +++ b/1151/CH1/EX1.23/example23.sce @@ -0,0 +1,2 @@ +//determine the transfer function
+printf("z1=(1+R*C*s)/(C*s)\n z2=1/(C*s) \n g=z2/z2 \nTransfer function Eo(s)/Ei(s)=g")
diff --git a/1151/CH1/EX1.24/example24.sce b/1151/CH1/EX1.24/example24.sce new file mode 100755 index 000000000..99df02246 --- /dev/null +++ b/1151/CH1/EX1.24/example24.sce @@ -0,0 +1,5 @@ +//find out transfer function of the system
+
+printf("z1=(1+R*C2*s)*C1/(C1+C2+C1*C2*R*s)\n f=K1/((s^2*M2+K1+K2)*(K1+s^2*M1)-K1^2 \n Transfer function of electrical network Vo(s)/Vi(s)=f");
+printf("g=(s*B+K2)/(K1+K2+s*B\n");
+printf("Transfer function ofmechanical network analogous to electrical network X2(s)/X1(s)=g");
diff --git a/1151/CH1/EX1.26/example26.sce b/1151/CH1/EX1.26/example26.sce new file mode 100755 index 000000000..e633cfc7b --- /dev/null +++ b/1151/CH1/EX1.26/example26.sce @@ -0,0 +1,3 @@ +//determine the transfer function
+printf("syms R1 R2 C1 C2\nz1=R2/(R2*C2*s+1);\n z2=(R1*C1*s+1)/(C1*s);\n g=z2/(z1+z2);Transfer function Eo(s)/Ei(s)=g")
+
diff --git a/1151/CH1/EX1.3/example3.sce b/1151/CH1/EX1.3/example3.sce new file mode 100755 index 000000000..8976872ec --- /dev/null +++ b/1151/CH1/EX1.3/example3.sce @@ -0,0 +1,3 @@ +//find transfer function of V2(s)/V1(s
+printf("syms R1 R2 C")
+printf("G=(R2+R1*R2*C*s)/(R1+R2+R1*R2*C*s)\n transfer function V2(s)/V1(s)=G")
diff --git a/1151/CH1/EX1.30/example30.sce b/1151/CH1/EX1.30/example30.sce new file mode 100755 index 000000000..9fa30d593 --- /dev/null +++ b/1151/CH1/EX1.30/example30.sce @@ -0,0 +1,4 @@ +//derive transfer function using block diagram reduction
+
+printf("syms G1 H1 G2 H2 H3 \n l1=G1/(1+G1*H1);//feedback configuration\n l2=G2/(1+G2*H2);//feedback configuration\n l3=l1*l2;//cascading combination\n g=l3/(1+l3*H3");
+printf("\nC(s)/R(s)=g")
diff --git a/1151/CH1/EX1.31/example31.sce b/1151/CH1/EX1.31/example31.sce new file mode 100755 index 000000000..ad0a4d933 --- /dev/null +++ b/1151/CH1/EX1.31/example31.sce @@ -0,0 +1,2 @@ +//find the transfer function using block diagram reduction
+printf("syms R1 R2 C1 C2 \n l1=1/(1+R2*C2*s);//unity feedback\nl2=1/(s*C1); \n l3=1/R1;\n l4=s*C2;\n l5=1+R2*C2*s;\n g1=l1*l2;//cascading of blocks\ng2=g1/(1+g1*l4);//feedback configuration\n g3=l3*g2;//cascading of blocks\n g4=g3/(1+g3*l5);\nTransfer function Vo(s)/Vi(s)=g4")
diff --git a/1151/CH1/EX1.32/example32.sce b/1151/CH1/EX1.32/example32.sce new file mode 100755 index 000000000..93c711f27 --- /dev/null +++ b/1151/CH1/EX1.32/example32.sce @@ -0,0 +1,2 @@ +//derive transfer function using block diagram reduction
+printf("syms G1 H1 G2 H2 \nG3l1=G2*G3;//cascading of blocks\nl2=l1/(1+l1*H2);//feedback configuration\nl3=l2*G1;//cascading of blocksl4=H1/G3;l5=l3/(1+l3*l2)\n C(s)/R(s)=l5")
diff --git a/1151/CH1/EX1.34/example34.sce b/1151/CH1/EX1.34/example34.sce new file mode 100755 index 000000000..f96cbfc61 --- /dev/null +++ b/1151/CH1/EX1.34/example34.sce @@ -0,0 +1,2 @@ +//derive transfer function using block diagram reduction
+printf("syms G1 H1 G2 H2 G3 G4\nl1=(G1-G1*G2*G4)/(1-G1*G2*G3*G4);//X1/R\nl2=G2*(1-G1*G3)/(1-G1*G2*G3*G4);//X2/R\n g=l1+l2;//X1/R+X2/R\n C(s)/R(s)=g");
diff --git a/1151/CH1/EX1.35/example35.sce b/1151/CH1/EX1.35/example35.sce new file mode 100755 index 000000000..447cdc54c --- /dev/null +++ b/1151/CH1/EX1.35/example35.sce @@ -0,0 +1,2 @@ +//determine transfer function using bloack diagram reduction techniques
+printf("syms H1 H2 G\n l1=H1/G;\n l2=1+l1;//parallel blocks\nl3=G/(1+G*H2);\nl4=l3*l2;\nC(s)/R(s)=l3");
diff --git a/1151/CH1/EX1.37/example37.sce b/1151/CH1/EX1.37/example37.sce new file mode 100755 index 000000000..91810aa14 --- /dev/null +++ b/1151/CH1/EX1.37/example37.sce @@ -0,0 +1,2 @@ +//derive transfer function using block diagram reduction
+printf("syms G1 H1 G2 H2 G3\n l1=G3/(1+G3*H1);//feedback blocks\n l2=G2*l1;//cascading of blocks\n l3=H2/G3;\n l4=l2/(1+l2*l3);//-ve feedback\n l5=l4*G1;//cascading blocks\n l6=l5/(1+l5);C(s)/R(s)=l6")
diff --git a/1151/CH1/EX1.38/example38.sce b/1151/CH1/EX1.38/example38.sce new file mode 100755 index 000000000..bc34dc297 --- /dev/null +++ b/1151/CH1/EX1.38/example38.sce @@ -0,0 +1,2 @@ +//derive transfer function using block diagram reduction
+printf("\nl1=3/(s+1);\n l2=-6/(s+2);\n l3=3/(s+3);\n g=l1+l2+l3;\nC(s)/R(s)=g")
diff --git a/1151/CH1/EX1.39/example39.sce b/1151/CH1/EX1.39/example39.sce new file mode 100755 index 000000000..0a83e270b --- /dev/null +++ b/1151/CH1/EX1.39/example39.sce @@ -0,0 +1,2 @@ +//derive transfer function using block diagram reduction
+printf("syms G1 H1 G2 H2\nL1=G1*G2/(1+G2*H2+G1*G2*H1) //WHEN R3=0,R2=0,R4=0\nL2=G2/(1+G2*H2+G1*G2*H1) //WHEN R3=0,R1=0,R4=0\nL3=-G2/(1+G2*H2+G1*G2*H1) //WHEN R2=0,R1=0,R4=0\nL4=-G2*G1*H1/(1+G2*H2+G1*G2*H1) //WHEN R2=0,R1=0,R3=0\nl=L1+L2+L3+L4;\nC(s)/R(s)=l")
diff --git a/1151/CH1/EX1.4/example4.sce b/1151/CH1/EX1.4/example4.sce new file mode 100755 index 000000000..9d0c9a78d --- /dev/null +++ b/1151/CH1/EX1.4/example4.sce @@ -0,0 +1,2 @@ +//find transfer function of lag network
+printf("syms R1 R2 C\n ei=(R1+R2+(1/C)*s);\n eo=(R2+(1/C)*s);\n G=eo/ei;\n transfer function Eo(s)/Ei(s)is:G")
diff --git a/1151/CH1/EX1.41/example41.sce b/1151/CH1/EX1.41/example41.sce new file mode 100755 index 000000000..0a34370b1 --- /dev/null +++ b/1151/CH1/EX1.41/example41.sce @@ -0,0 +1,5 @@ +//to find transfer function using mason gain formula
+
+printf("syms a12 a23 a32 a34 a42 a44 a35 a52 a45\n");
+printf("there are two forward paths:\n 1) x1 tox2 to x3 to x4 to x5\n 2) x1 to x2 to x3 to x5")
+printf("\nP1=a12*a23*a34*a45;//forward path2 gain\nP2=a12*a23*a35;//forward path1 gain\n//gain of individual loops\nL1=a23*a32;\nL2=a23*a34*a42;\nL3=a23*a34*a45*a52;\nL4=a23*a35*a52;\nL5=a44;\n//gain of two non touching loops\ng1=L1*L5;\n g2=L4*L5;\n//since all the loops touches the forward path1 and loop 5 do not touch forward path 2\nd1=1;\nd2=1-L5;\n d=1-(L1+L2+L3+L4+L5)+(g1+g2);\nG=(P1*d1+P2*d2)/d;\ntransfer function x5/x1=G")
diff --git a/1151/CH1/EX1.42/example42.sce b/1151/CH1/EX1.42/example42.sce new file mode 100755 index 000000000..c8dde05aa --- /dev/null +++ b/1151/CH1/EX1.42/example42.sce @@ -0,0 +1,3 @@ +//to find transfer function using mason gain formula
+
+printf("syms G1 G2 G3 G4 H1 H2 H3 H4\n//gains of forward paths\nP1=G1*G2*G3*G4;//forward path1 gain\nP2=G1*G5;//forward path2 gain\n//gain of individual loops\nL1=-G1*H1;\nL2=-G3*H2;\nL3=-G1*G2*G3*H3;\nL4=-H4;\n//gain of two non touching loops\ng1=G1*G3*H1*H2;\ng2=G1*H1*H4;\ng3=G3*H2*H4;\ng4=G1*G2*G3*H2*H4;\n//gain of three non touching loops\nl1=-G1*G3*H1*H2*H4;\n//since all the loops touches the forward path1 and loop 2 do not touch forward path 2\nd1=1;\nd2=1-L2;\nd=1-(L1+L2+L3+L4)+(g1+g2+g3+g4)-l1;\nG=(P1*d1+P2*d2)/d;\ntransfer function C/R=G")
diff --git a/1151/CH1/EX1.43/example43.sce b/1151/CH1/EX1.43/example43.sce new file mode 100755 index 000000000..4250148da --- /dev/null +++ b/1151/CH1/EX1.43/example43.sce @@ -0,0 +1,3 @@ +//to find transfer function using mason gain formula
+
+printf("syms G1 G2 G3 G4 G5 G6 H1 H2 \n //gains of forward paths\n P1=G1*G2*G3*G6;//forward path1 gain\n P2=G1*G2*G4*G6;//forward path2 gain\nP3=G1*G2*G5*G6;//forward path3 gain\n //gain of individual loops\n L1=-G1*H1;\n L2=-G1*G2*G3*H2;\n L3=-G1*G2*G4*H2;\n L4=-G1*G2*G5*H2;\n //NO TWO NON TOUCHING LOOPS ARE THERE\n d1=1;\n d2=1;\n d3=1;\n d=1-(L1+L2+L3+L4);\n G=(P1*d1+P2*d2+P3*d3)/d;\ntransfer function C/R=G")
diff --git a/1151/CH1/EX1.44/example44.sce b/1151/CH1/EX1.44/example44.sce new file mode 100755 index 000000000..966fe9aeb --- /dev/null +++ b/1151/CH1/EX1.44/example44.sce @@ -0,0 +1 @@ +printf("//to find transfer function using mason gain formula\nsyms G1 G2 G3 G4 \n//gains of forward paths\nP1=G1*G2*G3;//forward path1 gain\n P2=G4;//forward path2 gain\n//gain of individual loops\nL1=-G1*G2;\nL2=G2*G3;\n//NO TWO NON TOUCHING LOOPS ARE THERE\n//since all the loops touches the forward path1 and loop1 and 2 do not touch forward path 2\\nd1=1;\nd2=1-(L1+L2);\nG=(P1*d1+P2*d2)/d2;\ntransfer function C/R=G")
diff --git a/1151/CH1/EX1.45/example45.sce b/1151/CH1/EX1.45/example45.sce new file mode 100755 index 000000000..ae68be815 --- /dev/null +++ b/1151/CH1/EX1.45/example45.sce @@ -0,0 +1 @@ +printf("//to find transfer function using mason gain formula\n syms G1 G2 G3 G4 H1 H2 \n //gains of forward paths\n P1=G1*G2*G3;//forward path1 gain\n P2=-G1*G4;//forward path2 gain\n //gain of individual loops\nL1=-G1*G2*H1;\nL2=-G2*G3*H2;\nL3=-G1*G2*G3;\nL4=G1*G4;\nL5=G4*H2;\n//NO TWO NON TOUCHING LOOPS ARE THERE\nd1=1;\nd2=1;\nd=1-(L1+L2+L3+L4+L5);\nG=(P1*d1+P2*d2)/d;\ntransfer function C/R=G")
diff --git a/1151/CH1/EX1.46/example46.sce b/1151/CH1/EX1.46/example46.sce new file mode 100755 index 000000000..db0d6b4c7 --- /dev/null +++ b/1151/CH1/EX1.46/example46.sce @@ -0,0 +1,3 @@ +//to find transfer function using mason gain formula
+
+printf("syms G1 G2 G3 G4 H1 H2 \n //gains of forward paths\n P1=G1*G2*G3;//forward path1 gain\n P2=G4;//forward path2 gain\n //gain of individual loops\n L1=-G2*H1;\n L2=-G1*G2*H1;\n L3=-G2*G3*H2;\n //there are no two non touching loops\n //since all the loops touches the forward path1 and loop 1,2,3 do not touch forward path 2\n d1=1;\n d2=1-(L1+L3+L2);\n G=(P1*d1+P2*d2)/d2;\n transfer function C/R=G")
diff --git a/1151/CH1/EX1.48/example48.sce b/1151/CH1/EX1.48/example48.sce new file mode 100755 index 000000000..11950933f --- /dev/null +++ b/1151/CH1/EX1.48/example48.sce @@ -0,0 +1,27 @@ +//to find transfer function using mason gain formula
+
+syms G1 G2 G3 G4 G5 G6 G7 G8 H1 H2
+//gains of forward paths
+P1=G2*G6*G4;//forward path1 gain
+P2=G3*G5*G7;//forward path2 gain
+P3=G1*G2*G7;//forward path3 gain
+P4=G3*G8*G6;//forward path4 gain
+P5=-G1*G2*G8*G6*H2;//forward path5 gain
+P6=-G3*G8*G1*G7*H1;//forward path6 gain
+//gain of individual loops
+L1=-G4*H1;
+L2=-G5*H2;
+L3=H1*H2*G1*G8;
+//gain of two non touching loops
+g1=G5*G4*H1*H2;
+
+//since all the loops touches the forward path3,4,5,6 and loop 2 do not touch forward path 1 and loop1 donot touch forward path2
+d1=1-L2;
+d2=1-L1;
+d3=1;
+d4=1;
+d5=1;
+d6=1;
+d=1-(L1+L2+L3)+g1;
+G=(P1*d1+P2*d2+P4*d4+P3*d3+P5*d5+P6*d6)/d;
+disp(G,"transfer function C/R=")
diff --git a/1151/CH1/EX1.49/example49.sce b/1151/CH1/EX1.49/example49.sce new file mode 100755 index 000000000..8f31d3149 --- /dev/null +++ b/1151/CH1/EX1.49/example49.sce @@ -0,0 +1,3 @@ +//to find transfer function using mason gain formula
+
+printf("syms R1 R2 C1 C2 \n //gains of forward path\n P1=1/(R1*R2*C1*C2*s^2);//forward path1 gain\n //gain of individual loops\n L1=-1/(R1*C1*s);\n L2=-1/(R2*C1*s);\n L3=-1/(R2*C2*s);\n //gain of two non touching loops\n g1=1/(s^2*R1*R2*C1*C2);\n //since all the loops touches the forward path1 so\n d1=1\n d=1-(L1+L2+L3)+g1;\n G=(P1*d1)/d;\n transfer function C/R=G")
diff --git a/1151/CH1/EX1.5/example5.sce b/1151/CH1/EX1.5/example5.sce new file mode 100755 index 000000000..a1518e17b --- /dev/null +++ b/1151/CH1/EX1.5/example5.sce @@ -0,0 +1,2 @@ +//determine the transfer function
+printf("syms R1 R2 C1 C2 \n z1=R1/(R1*C1*s+1);\n z2=(R2*C2*s+1)/(C2*s)\n g=z2/(z1+z2)\n Transfer function Eo(s)/Ei(s)= g")
diff --git a/1151/CH1/EX1.51/example51.sce b/1151/CH1/EX1.51/example51.sce new file mode 100755 index 000000000..ec240bdfa --- /dev/null +++ b/1151/CH1/EX1.51/example51.sce @@ -0,0 +1,6 @@ +printf("\n A thermometer has time constant =15.33sec\n its quickly taken from 0 (degree C) to water bath having a temperatur 100(degree C)\n find the temperature indicated after 60 sec ");
+printf("temperature indicated by thermometer can be given as =100*(1-e^-(t/T))");
+T=15.33;
+t=60;
+h=100*(1-%e^-(t/T));
+disp(h,"temperature indicated by thermometer(in degree C)) after 60 seconds=")
diff --git a/1151/CH1/EX1.6/example6.sce b/1151/CH1/EX1.6/example6.sce new file mode 100755 index 000000000..f13e07979 --- /dev/null +++ b/1151/CH1/EX1.6/example6.sce @@ -0,0 +1,2 @@ +//determine the transfer function of the transformer coupled network
+printf("syms R1 R2 C2 C1 L1 L2 M L3 \n G=s^3*R2*C1*C2*M/(((s^2*C2*(L3+L2))+1+s*R2*C2)*(S^2*L1*C1+s*C1*R1+1)-M^2*s^4*C1*C2)\n Transfer function=G")
diff --git a/1151/CH1/EX1.8/example8.sce b/1151/CH1/EX1.8/example8.sce new file mode 100755 index 000000000..519df72f4 --- /dev/null +++ b/1151/CH1/EX1.8/example8.sce @@ -0,0 +1,5 @@ +//find out transfer function of the system
+
+printf("syms K1 K2 M1 M2")
+printf(" the differential equatios in laplace form are \n F(s)=M1*S^2*X1(s)+K1*X1(s)-K2*X2(s)")
+printf("\n X1(s)=X2(s)*(s^2*M2+K1+K2)/K1 \n f=K1/((s^2*M2+K1+K2)*(K1+s^2*M1)-K1^2)\nTransfer function X2(s)/F(s)=f")
diff --git a/1151/CH1/EX1.9/example9.sce b/1151/CH1/EX1.9/example9.sce new file mode 100755 index 000000000..b42fac7fe --- /dev/null +++ b/1151/CH1/EX1.9/example9.sce @@ -0,0 +1,4 @@ +//write down equations for block diagram
+printf("F(s)=M*s^2*X(s)+B*S*X(s)+K*X(s) \n given\n M=10 kg \n B=30N/m/sec \n K=20N/m")
+printf("putting the values in the above equation")
+printf("F(s)=10*s^2*X(s)+30*S*X(s)+20*X(s")
diff --git a/1151/CH11/EX11.1/example1.sce b/1151/CH11/EX11.1/example1.sce new file mode 100755 index 000000000..7a23cec31 --- /dev/null +++ b/1151/CH11/EX11.1/example1.sce @@ -0,0 +1,23 @@ +printf(" Given C(s)/R(s)=14/(s^2+1.4*s+14)")
+printf("characterstic equation of the given system is s^2+1.4*s+14=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(14);
+d=1.4/(2*w);
+d1=.7;
+t=2*(d1-d)/w;
+pt1=%pi/(w*sqrt(1-d^2));
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+rt=(%pi-atan(sqrt((1-d)/d)))/(w*sqrt(1-d^2));
+disp(t,"Td=")
+disp(pt1,"peak time(in sec)for sytem without derivative control is")
+disp(rt,"rise time(in sec)for sytem without derivative control is")
+disp(mo1,"maximum overshoot(in %)for sytem without derivative control is")
+printf("overal transfer function with derivative control is C(s)/R(s)=14*(1+0.274*s)/(s^2+5.236*s+14)")
+printf("c(t)=1-e^(-2.618*t)*cos(2.673*t)+0.455*e^(-2.618t)*sin(2.673t)")
+tp=(%pi-atan(2.58))/2.673;
+tr=(1/2.673)*atan(1/0.455);
+mo2=1-%e^(-2.618*tp)*cos(2.673*tp)+0.455*%e^(-2.618*tp)*sin(2.673*tp);
+mp=(mo2-1)*100;
+disp(tp,"peak time(in sec)for sytem with derivative control is")
+disp(tr,"rise time(in sec)for sytem with derivative control is")
+disp(mp,"maximum overshoot(in %)for sytem with derivative control is")
diff --git a/1151/CH11/EX11.2/example2.sce b/1151/CH11/EX11.2/example2.sce new file mode 100755 index 000000000..c398f90f6 --- /dev/null +++ b/1151/CH11/EX11.2/example2.sce @@ -0,0 +1,20 @@ +printf("characterstic equation of the given system is s^2+1.4*s+14=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(14);
+d=1.4/(2*w);
+d1=.7;
+Kt=2*(d1-d)/w;
+ess1=2*d/w;
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(ess1,"steady state error without derivative control = ")
+printf("overal transfer function with derivative control is C(s)/R(s)=w^2/(s^2+(2dw+w^2Kt)*s+w^2)=14/(s^2+5.23*s+14")
+disp(Kt,"Kt=")
+rt=(%pi-atan(sqrt((1-d1)/d1)))/(w*sqrt(1-d1^2));
+pt1=%pi/(w*sqrt(1-d1^2));
+mo1=exp((-%pi*d1)/sqrt(1-d1^2))*100;
+ess2=2*d1/w+Kt;
+disp(pt1,"peak time(in sec)for sytem with derivative control is")
+disp(rt,"rise time(in sec)for sytem with derivative control is")
+disp(mo1,"maximum overshoot(in %)for sytem with derivative control is")
+disp(ess2,"steady state error with derivative control = ")
diff --git a/1151/CH11/EX11.3/example3.sce b/1151/CH11/EX11.3/example3.sce new file mode 100755 index 000000000..60ef2b195 --- /dev/null +++ b/1151/CH11/EX11.3/example3.sce @@ -0,0 +1,27 @@ +printf(" Given C(s)/R(s)=10/(s^2+2*s+10)")
+printf("characterstic equation of the given system is s^2+2*s+10=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(10);
+d=1/(2*w);
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+ts1=4/(d*w);
+ess1=2*d/w;
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(ess1,"steady state error without error control = ")
+disp(ts1,"settling time(in sec)for sytem without derivative control is")
+disp(mo1,"maximum overshoot(in %)for sytem without derivative control is")
+printf("overal transfer function with derivative control is C(s)/R(s)=10(1+s*Ke)/(s*(s+2)+10*(1+s*Ke))")
+printf("characterstic equation of the error control system is s^2+s*(2+10*Ke)+10=0");
+Ke=(2*d*w-2)/10;
+disp(Ke,"Ke=");
+printf("characterstic equation of the error control system with Ke = 0.16 is s^2+s*3.16+10)=0");
+d2=3.16/(2*w);
+mo2=exp((-%pi*d2)/sqrt(1-d2^2))*100;
+ts2=4/(d2*w);
+ess2=2*d2/w;
+disp(d2,"damping ratio for error control system=")
+disp(w,"natural frrequency(in rad/sec) of error control system=")
+disp(ess2,"steady state error with error control = ")
+disp(ts2,"settling time(in sec)for sytem with derivative control is")
+disp(mo2,"maximum overshoot(in %)for sytem with derivative control is")
diff --git a/1151/CH11/EX11.4/example4.sce b/1151/CH11/EX11.4/example4.sce new file mode 100755 index 000000000..f3b65377a --- /dev/null +++ b/1151/CH11/EX11.4/example4.sce @@ -0,0 +1,15 @@ +printf(" unity feedback system with transfer function G(s)=K/(s*(s+10))\n Determine K so that the syetm will have damping ratio0.5.For this value of K find settling time ,peak overshootand peak time for unit step input");
+printf("characterstic equation of the given system is 1+G(s)H(s)=s^2+10*s+K=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d=0.5;
+K=(10/(2*d))^2;
+w=sqrt(K);
+ts1=4/(d*w);
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+pt1=%pi/(w*sqrt(1-d^2));
+disp(K,"K=")
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(pt1,"peak time(in sec)for sytem is")
+disp(mo1,"maximum overshoot(in %)for sytem is")
+disp(ts1,"settling time(in sec)is")
diff --git a/1151/CH11/EX11.5/example5.sce b/1151/CH11/EX11.5/example5.sce new file mode 100755 index 000000000..b843949ca --- /dev/null +++ b/1151/CH11/EX11.5/example5.sce @@ -0,0 +1,15 @@ +printf(" Given G(s)=10/(s*(s+2))");
+printf("characterstic equation of the given system is 1+G(s)H(s)= s^2+2*s+10=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(10);
+d=1/(2*w);
+ess1=2*d/w;
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(ess1,"steady state error without error control = ")
+printf("overal transfer function with derivative control is C(s)/R(s)=10/(s^2+(2+K)*s+10))")
+printf("characterstic equation of the error control system is s^2+s*(2+K)+10=0");
+K=(2*d*w-2)/10;
+disp(K,"K=");
+ess=0.38
+disp(ess,"steady state error=")
diff --git a/1151/CH11/EX11.6/example6.sce b/1151/CH11/EX11.6/example6.sce new file mode 100755 index 000000000..97e9a310d --- /dev/null +++ b/1151/CH11/EX11.6/example6.sce @@ -0,0 +1,16 @@ +printf(" Given G(s)=10/(s*(s+2))");
+printf("characterstic equation of the given system is 1+G(s)H(s)= s^2+2*s+10=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(10);
+d=1/(2*w);
+ess1=2*d/w;
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(ess1,"steady state error without error control = ")
+printf("overal transfer function with derivative control is C(s)/R(s)=2*Ka/(s^2+s*(2+2*Ka)+2*Ka))");
+printf("characterstic equation of the error control system is s^2+s*(2+2*Ka)+2*Ka=0");
+printf("1+Kt=0.2*Ka");
+Ka=(1.98/0.4)^2;
+Kt=0.2*Ka-1;
+disp(Ka,"Ka=")
+disp(Kt,"Kt=")
diff --git a/1151/CH11/EX11.7/example7.sce b/1151/CH11/EX11.7/example7.sce new file mode 100755 index 000000000..97e9a310d --- /dev/null +++ b/1151/CH11/EX11.7/example7.sce @@ -0,0 +1,16 @@ +printf(" Given G(s)=10/(s*(s+2))");
+printf("characterstic equation of the given system is 1+G(s)H(s)= s^2+2*s+10=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(10);
+d=1/(2*w);
+ess1=2*d/w;
+disp(d,"damping ratio")
+disp(w,"natural frrequency(in rad/sec)=")
+disp(ess1,"steady state error without error control = ")
+printf("overal transfer function with derivative control is C(s)/R(s)=2*Ka/(s^2+s*(2+2*Ka)+2*Ka))");
+printf("characterstic equation of the error control system is s^2+s*(2+2*Ka)+2*Ka=0");
+printf("1+Kt=0.2*Ka");
+Ka=(1.98/0.4)^2;
+Kt=0.2*Ka-1;
+disp(Ka,"Ka=")
+disp(Kt,"Kt=")
diff --git a/1151/CH2/EX2.1/example1.sce b/1151/CH2/EX2.1/example1.sce new file mode 100755 index 000000000..b90889e7a --- /dev/null +++ b/1151/CH2/EX2.1/example1.sce @@ -0,0 +1,11 @@ +//determine rise time,peak time,setlling time and peak overshoot
+delta=0.5 // damping ratio
+w=6//rad/sec
+rt=(%pi-atan(sqrt((1-delta)/delta)))/(w*sqrt(1-delta^2));
+disp(rt,"the rise time is ")//seconds
+pt=%pi/(w*sqrt(1-delta^2));
+disp(pt,"peak time is")//seconds
+st=4/(delta*w);
+mo=exp((-%pi*delta)/sqrt(1-delta^2))*100;
+disp(st,"settling time(in seconds)")
+disp(mo,"maximum overshoot(in %)")
diff --git a/1151/CH2/EX2.10/example10.sce b/1151/CH2/EX2.10/example10.sce new file mode 100755 index 000000000..27edd2158 --- /dev/null +++ b/1151/CH2/EX2.10/example10.sce @@ -0,0 +1,12 @@ +printf("closed loop transfer function =K/(s^2+K*H*s+K))");
+printf("characterstic equation of the given system is s^2+K*H*s+K=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d1=log(0.25);
+d=sqrt(d1^2/(d1^2+%pi^2));
+w=%pi/(2*sqrt(1-d^2));
+K=w^2;
+H=2*d*w/K;
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=");
+disp(K,"value of K=");
+disp(H,"value of H=");
diff --git a/1151/CH2/EX2.11/example11.sce b/1151/CH2/EX2.11/example11.sce new file mode 100755 index 000000000..1576d394f --- /dev/null +++ b/1151/CH2/EX2.11/example11.sce @@ -0,0 +1,17 @@ +printf("the second order control system has transfer function Q(s)/T(s)=1/(J*s^2+f*s+k)");
+printf("given T(s)= 10/s");
+printf("Q(s)=1/(s*(J*s^2+f*s+k)");
+printf("characterstic equation of the given system is J*s^2+f*s+k =0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+k=10/0.5;
+d1=log(0.06);
+d=sqrt(d1^2/(d1^2+%pi^2));
+w=%pi/sqrt(1-d^2);
+j=k/w^2;
+f=2*d*w*j;
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=");
+disp(k,"value of K=");
+disp(j,"value of J=");
+disp(f,"value of f=");
+
diff --git a/1151/CH2/EX2.12/example12.sce b/1151/CH2/EX2.12/example12.sce new file mode 100755 index 000000000..fdcd3ffaf --- /dev/null +++ b/1151/CH2/EX2.12/example12.sce @@ -0,0 +1,9 @@ +printf("closed loop transfer function =16/(s^2+(4+16*K)*s+16)");
+printf("characterstic equation of the given system is 4+16*K)*s+16=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(16);
+d=0.8;//given
+k=(2*d*w-4)/16;
+mo=exp((-%pi*d)/sqrt(1-d^2))*100;
+disp(k,"value of K=");
+disp(mo,"maximum overshoot(in %)");
diff --git a/1151/CH2/EX2.13/example13.sce b/1151/CH2/EX2.13/example13.sce new file mode 100755 index 000000000..8ba6dd74a --- /dev/null +++ b/1151/CH2/EX2.13/example13.sce @@ -0,0 +1,8 @@ + clc;printf("closed loop transfer function =(K/T)/(s^2+s/T+K/T))");
+printf("characterstic equation of the given system is s^2+s/T+K/T=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d2=0.9;
+d1=0.3;
+c=(d1/d2)^2;
+disp(c,"K1/K2=")
+printf("hence,the gain K1 at which d=0.3 should be multiplied by 1/9 in order to increase the damping ratio from 0.3 to 0.9");
diff --git a/1151/CH2/EX2.14/example14.sce b/1151/CH2/EX2.14/example14.sce new file mode 100755 index 000000000..a158107f5 --- /dev/null +++ b/1151/CH2/EX2.14/example14.sce @@ -0,0 +1,12 @@ + clc;printf("closed loop transfer function =(K/T)/(s^2+s/T+K/T))");
+printf("characterstic equation of the given system is s^2+s/T+K/T=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d1=log(0.254);
+d=sqrt(d1^2/(d1^2+%pi^2));
+w=%pi/(3*sqrt(1-d^2));
+t=1/(2*d*w);
+k=w^2*t;
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=");
+disp(k,"value of K=");
+disp(t,"value of T=");
diff --git a/1151/CH2/EX2.15/example15.sce b/1151/CH2/EX2.15/example15.sce new file mode 100755 index 000000000..f468b1077 --- /dev/null +++ b/1151/CH2/EX2.15/example15.sce @@ -0,0 +1,25 @@ +printf("closed loop transfer function =16/(s^2+s+16)");
+printf("characterstic equation of the given system is s^2+s+16=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(16);
+d=0.5/w;
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=");
+printf("now consider H(s)=1+Ks");
+printf("characterstic equation of this system is s^2+(1+16K)*s+16=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d1=0.6;
+k=(2*w*d1-1)/16;
+disp(k," value of K when d=0.6 is")
+pt1=%pi/(w*sqrt(1-d^2));
+pt2=%pi/(w*sqrt(1-d1^2));
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+mo2=exp((-%pi*d1)/sqrt(1-d1^2))*100;
+st1=4/(d*w);
+st2=4/(d1*w);
+disp(pt1,"peak time (in sec) when damping ratio is 0.125:");
+disp(pt2,"peak time(in sec) when damping ratio is 0.6:");
+disp(mo1,"mAXIMUM OVERSHOOT (in %) when damping ratio is 0.125:");
+disp(mo2,"mAXIMUM OVERSHOOT (in %) when damping ratio is 0.6:");
+disp(st1,"setlling time(in sec) when damping ratio is 0.125:");
+disp(st2,"setlling time (in sec) when damping ratio is 0.:");
diff --git a/1151/CH2/EX2.16/example16.sce b/1151/CH2/EX2.16/example16.sce new file mode 100755 index 000000000..429dea3c3 --- /dev/null +++ b/1151/CH2/EX2.16/example16.sce @@ -0,0 +1,7 @@ +printf(" given d1=0.8 and d2=0.2");
+printf(" we have to dtermine the time constant T for which the damping ratio is reduced from 0.8 to 0.2");
+d1=0.8;
+d2=0.2;
+c=d1/d2;
+disp(c^2,"T2/T1=");
+printf("hence, the original time constant T1 should be multiplied by 16, then the damping ratio becomes 0.2");
diff --git a/1151/CH2/EX2.17/example17.sce b/1151/CH2/EX2.17/example17.sce new file mode 100755 index 000000000..b4536643c --- /dev/null +++ b/1151/CH2/EX2.17/example17.sce @@ -0,0 +1,14 @@ +printf("closed loop transfer function =16/(s^2+(0.8+16K)*s+16");
+printf("characterstic equation of this system is s^2+(0.8+16K)*s+16=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(16);
+d=0.5;
+k=(2*w*d-0.8)/16;
+rt=(%pi-atan(sqrt((1-d)/d)))/(w*sqrt(1-d^2));
+pt1=%pi/(w*sqrt(1-d^2));
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+st1=4/(d*w);
+disp(k," value of K is");
+disp(pt1,"peak time (in sec) :");
+disp(mo1,"mAXIMUM OVERSHOOT (in %) :");
+disp(st1,"setlling time(in sec):");
diff --git a/1151/CH2/EX2.18/example18.sce b/1151/CH2/EX2.18/example18.sce new file mode 100755 index 000000000..ec53d3f27 --- /dev/null +++ b/1151/CH2/EX2.18/example18.sce @@ -0,0 +1,9 @@ +printf("closed loop transfer function =K/(s^2+(2+kK)*s+K) withd=0.7 and w=4 rad/sec");
+printf("characterstic equation of this system is s^2+(2+kK)*s+K=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=4;
+K=w^2;
+d=0.7;
+k=(2*d*w-2)/K;
+disp(K,"Value of K is");
+disp(k,"Value of k is");
diff --git a/1151/CH2/EX2.19/example19.sce b/1151/CH2/EX2.19/example19.sce new file mode 100755 index 000000000..a2eccf2eb --- /dev/null +++ b/1151/CH2/EX2.19/example19.sce @@ -0,0 +1,7 @@ +printf ("time required ny the thermometer to indicate 9805 of the response to a step input=1 minute=60 seconds");
+printf("for 1st order sytem \n c(t)=1-e^(-t/T)\n we have to find time constant T");
+c=0.98;
+d=1-c;
+f=log(d);
+h=-60/f;
+disp(h,"time constant T (in sec)=");
diff --git a/1151/CH2/EX2.20/example20.sce b/1151/CH2/EX2.20/example20.sce new file mode 100755 index 000000000..55df0d043 --- /dev/null +++ b/1151/CH2/EX2.20/example20.sce @@ -0,0 +1,7 @@ +printf("closed loop transfer function =10/(s^2+(1+10K)*s+10) with d=0.5" );
+printf("characterstic equation of this system is s^2+(1+10K)*s+10=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d=0.5;
+w=sqrt(10);
+k=(2*d*w-1)/10;
+disp(k,"Value of K is");
diff --git a/1151/CH2/EX2.22/example22.sce b/1151/CH2/EX2.22/example22.sce new file mode 100755 index 000000000..099d83e61 --- /dev/null +++ b/1151/CH2/EX2.22/example22.sce @@ -0,0 +1,13 @@ +printf("closed loop transfer function =1/s(s+1)");
+printf("characterstic equation of this system is s^2+s+1=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=1;
+d=0.5/w;
+rt=(%pi-atan(sqrt((1-d)/d)))/(w*sqrt(1-d^2));
+pt1=%pi/(w*sqrt(1-d^2));
+mo1=exp((-%pi*d)/sqrt(1-d^2))*100;
+st1=4/(d*w);
+disp(k," value of K is");
+disp(pt1,"peak time (in sec) :");
+disp(mo1,"mAXIMUM OVERSHOOT (in %) :");
+disp(st1,"setlling time(in sec):");
diff --git a/1151/CH2/EX2.23/example23.sce b/1151/CH2/EX2.23/example23.sce new file mode 100755 index 000000000..dadde6f2d --- /dev/null +++ b/1151/CH2/EX2.23/example23.sce @@ -0,0 +1,10 @@ +printf("closed loop transfer function C(s)/R(s)=w^2/(s^2+2*d*w*s+w^2)");
+printf("characterstic equation of this system is s^2+2*d*w*s+w^2=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+printf("we have to determine w and d given maximum overshoot=0.05 and settling time =2 sec");
+t=2;
+d1=log(0.05);
+d=sqrt(d1^2/(d1^2+%pi^2));
+w=4/(d*t);
+disp(d,"damping ratio:");
+disp(w,"natural undamped frequency (in rad/sec):")
diff --git a/1151/CH2/EX2.24/example24.sce b/1151/CH2/EX2.24/example24.sce new file mode 100755 index 000000000..f7e255738 --- /dev/null +++ b/1151/CH2/EX2.24/example24.sce @@ -0,0 +1,16 @@ +printf("given G(s)=K/(s*(1+s*T)) \n Mp=20 percent \n resonant frequency=6 rad/sec\n we have to determine the value of K,T,resonant peak")
+printf(" H(s)=1 \n C(s)/R(s)=G(s)/(1+G(s)*H(s)) \n =(K/T)/(s^2+s/T+(K/T)");
+printf("compare with w^2/(s^2+2*d*w*s+w^2)");
+d1=log(0.2);
+d=sqrt(d1^2/(d1^2+%pi^2));
+wr=6;
+w=wr/sqrt(1-(2*(d^2)));
+K=sqrt(4*d*w^2);
+T=sqrt(4*d/w^2);
+mr=1/(2*d*sqrt(1-d^2));
+disp(w,"undamped natural frequency (in rad/sec)=")
+disp(d,"damping ratio=")
+disp(K,"value of K=")
+disp(T,"value of T=")
+disp(mr,"resonance peak=")
+
diff --git a/1151/CH2/EX2.25/example25.sce b/1151/CH2/EX2.25/example25.sce new file mode 100755 index 000000000..41036b583 --- /dev/null +++ b/1151/CH2/EX2.25/example25.sce @@ -0,0 +1,8 @@ +printf("given c(t)=1+0.2^e-60t-1.2*e^-10t");
+printf("Laplace transform is C(s)=600/(s*(s+10)*(s+60))\n R(s)=1/s \n transfer function is C(s)/R(s)=600/((s+2)*(s+60))");
+printf("characterstic equation of this system is s^2+70*s+600=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(600);
+d=70/(2*w);
+disp(d,"damping ratio:");
+disp(w,"natural undamped frequency (in rad/sec):")
diff --git a/1151/CH2/EX2.3/example3.sce b/1151/CH2/EX2.3/example3.sce new file mode 100755 index 000000000..8ca7c33c7 --- /dev/null +++ b/1151/CH2/EX2.3/example3.sce @@ -0,0 +1,7 @@ +//time requiredto get second peak
+
+printf("c(s)=25/(s*(s^2+8*s+25))");
+w=sqrt(25);
+d=0.8;
+t=3*%pi/(w*sqrt(1-d^2));
+disp(t,"required time");
diff --git a/1151/CH2/EX2.4/example4.sce b/1151/CH2/EX2.4/example4.sce new file mode 100755 index 000000000..68c8194e8 --- /dev/null +++ b/1151/CH2/EX2.4/example4.sce @@ -0,0 +1,7 @@ +printf("C(s)=16/(s^2+(0.8+16a)*s+16)");
+w=sqrt(16);delta=0.5;
+a=(2*d*w-0.8)/16;
+t=(%pi-atan(sqrt((1-delta)/delta)))/(w*sqrt(1-delta^2));
+mo=exp((-%pi*delta)/sqrt(1-delta^2))*100;
+disp(t,"the rise time (in seconds)is ")//seconds
+disp(mo,"maximum overshoot(in%)")
diff --git a/1151/CH2/EX2.5/example5.sce b/1151/CH2/EX2.5/example5.sce new file mode 100755 index 000000000..032514139 --- /dev/null +++ b/1151/CH2/EX2.5/example5.sce @@ -0,0 +1,12 @@ +printf("closed loop transfer function =G/(s^2+3*s+G)");
+printf("characterstic equation of the given system is s^2+3*s+G=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+d=0.6;//assume
+G=(1.5/d)^2;
+G'=2*G;
+w=sqrt(G');
+d'=1.5/w;
+w'=w*sqrt(1-d'^2);
+t=2*%pi/w';
+disp(G,"the minimum value of G for the step response of the system that it will exhibit an overshoot is");
+disp(t,"if G is twice the minimum value then time period T(in sec)= ")
diff --git a/1151/CH2/EX2.6/example6.sce b/1151/CH2/EX2.6/example6.sce new file mode 100755 index 000000000..61349a9c4 --- /dev/null +++ b/1151/CH2/EX2.6/example6.sce @@ -0,0 +1,11 @@ +printf("open loop transfer function G(s)=10/((s+2)*(s+5))");
+printf("for unity feedback system H(s)=1")
+printf("characterstic equation of closed loop system is 1+G(s)H(s)=0");
+printf("characterstic equation of the given system is s^2+7*s+");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+w=sqrt(20);
+d=7/(2*w);
+mo=exp((-%pi*d)/sqrt(1-d^2))*100;
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=")
+disp(mo,"maximum overshoot(in %)")
diff --git a/1151/CH2/EX2.8/example8.sce b/1151/CH2/EX2.8/example8.sce new file mode 100755 index 000000000..05b386c88 --- /dev/null +++ b/1151/CH2/EX2.8/example8.sce @@ -0,0 +1,11 @@ + printf("closed loop transfer function =K/(s^2+s/T+K/T))");
+printf("characterstic equation of the given system is s^2+s/T+K/T=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+m1=.75;
+m2=.25;
+t1=-log(m1);
+t2=-log(m2);
+c=t1/t2;
+d1=.4037;d2=.09118;
+e=d1/d2;
+disp(e^2,"K1/K2=");
diff --git a/1151/CH2/EX2.9/example9.sce b/1151/CH2/EX2.9/example9.sce new file mode 100755 index 000000000..8a0079a5e --- /dev/null +++ b/1151/CH2/EX2.9/example9.sce @@ -0,0 +1,10 @@ +printf("closed loop transfer function =1/(s^2+R/L*s+1/LC)");
+printf("characterstic equation of the given system is s^2+R/L*s+1/LC=0");
+printf("compare it with the standard second order characterstic equation s^2+2*d*w*s+w^2=0");
+R=1000; //given
+L=10^-2;//given
+C=10^-8;//given
+d=R/2*sqrt(C/L);
+w=1/sqrt(L*C);
+disp(d,"damping ratio=");
+disp(w,"undamped natural frequency(in rad/sec)=");
diff --git a/1151/CH3/EX3.1/test.sce b/1151/CH3/EX3.1/test.sce new file mode 100755 index 000000000..a3b21be32 --- /dev/null +++ b/1151/CH3/EX3.1/test.sce @@ -0,0 +1,46 @@ +s=%s
+p= poly([0 0 50],'s','coeff');
+q= poly([0.1 2 10],'s','coeff');
+M=p/q
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R
+disp (Ess ," f o r u n i t s t e p input Ess=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Es s=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H
+disp (Ess ," for unit ramp input Ess=")
+ else printf (" for unit ramp input Es s=infinite\n")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" f o r u n i t p a r a b o l i c input Es s=0 \n")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H
+ disp (Ess ," for unit parabolic input Ess=")
+ else printf (" for unit parabolic input Ess=infinite \n")
+ end
+ end
diff --git a/1151/CH3/EX3.2/example2.sce b/1151/CH3/EX3.2/example2.sce new file mode 100755 index 000000000..df1d8eced --- /dev/null +++ b/1151/CH3/EX3.2/example2.sce @@ -0,0 +1,52 @@ +s=%s
+p= poly([5 10 500],'s','coeff' );
+q= poly([1.8 25 10 0 0],'s','coeff' );
+M=p/q
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R;
+ kp=(1-Ess)/Ess;
+disp (Ess ," f o r u n i t s t e p input Ess=")
+disp(kp,"Kp=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Es s=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H;
+kv=1/Ess;
+disp (Ess ," for unit ramp input Ess=")
+disp(kv,"Kv=")
+ else printf (" for unit ramp input Ess=infiite \n")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" f o r u n i t p a r a b o l i c input Ess=0 \nn")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H;
+ka=1/Ess;
+ disp (Ess ," for unit parabolic input Ess=")
+ diisp(ka,"Ka=")
+ else printf (" for unit parabolic input Ess=infinite \nn")
+ end
+ end
diff --git a/1151/CH3/EX3.3/example3.sce b/1151/CH3/EX3.3/example3.sce new file mode 100755 index 000000000..6f63bc25b --- /dev/null +++ b/1151/CH3/EX3.3/example3.sce @@ -0,0 +1,9 @@ + // g i v e n G(s)H(s) =K/ s (s+20) H(s)=1 R(s)=1/s^2
+G =1+400/(s*(s+20));
+h=1/G;
+r=1/s^2;
+e= 0.05;
+disp (e," Steady state error=")
+//if ess=0.02 then k=?
+k=20/0.02;
+disp(k,"K=");
diff --git a/1151/CH3/EX3.4/example4.sce b/1151/CH3/EX3.4/example4.sce new file mode 100755 index 000000000..09c3505fb --- /dev/null +++ b/1151/CH3/EX3.4/example4.sce @@ -0,0 +1,51 @@ +s=%s
+p= poly([0 0 20],'s','coeff');
+q= poly([1 2 22 4 40 0], 's','coeff');
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R;
+ kp=(1-Ess)/Ess;
+disp (Ess ," f o r u n i t s t e p input Ess=")
+disp(kp,"Kp=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Ess=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H;
+kv=1/Ess;
+disp (Ess ," for unit ramp input Ess=")
+disp(kv,"Kv=")
+ else printf (" for unit ramp input Ess=infinite \nn")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" for unit parabolic input Ess=0 \nn")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H;
+ka=1/Ess;
+ disp (Ess ," for unit parabolic input Ess=")
+ diisp(ka,"Ka=")
+ else printf (" for unit parabolic input Ess=infinite\nn")
+ end
+ end
diff --git a/1151/CH3/EX3.5/example5.sce b/1151/CH3/EX3.5/example5.sce new file mode 100755 index 000000000..e3af87f96 --- /dev/null +++ b/1151/CH3/EX3.5/example5.sce @@ -0,0 +1,52 @@ +s=%s
+p= poly([0 0 108],'s','coeff');
+q= poly([1 7 24 48 0 0],'s','coeff');
+M=p/q
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R;
+ kp=(1-Ess)/Ess;
+disp (Ess ," f o r u n i t s t e p input Ess=")
+disp(kp,"Kp=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Es s=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H;
+kv=1/Ess;
+disp (Ess ," for unitramp input Ess=")
+disp(kv,"Kv=")
+ else printf (" for unit ramp input Ess=infinite \nn")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" f o r u n i t p a r a b o l i c input Es s=0 \nn")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H;
+ka=1/Ess;
+ disp (Ess ," for unit parabolic input Ess=")
+ diisp(ka,"Ka=")
+ else printf (" for unit parabolic input Ess=infinite\nn")
+ end
+ end
diff --git a/1151/CH3/EX3.6/example6.sce b/1151/CH3/EX3.6/example6.sce new file mode 100755 index 000000000..49a69ac1b --- /dev/null +++ b/1151/CH3/EX3.6/example6.sce @@ -0,0 +1,5 @@ +//determine the type of following feedback system
+printf("a) G(s)=K/((s+10)*(s+5) \n solution : Since in denominator the power of s is zero i.e.m=0,henece its type zero system");
+printf("\n b) G(s)=20/(s*(0.05*s+1)*(0.1*s+1) \n solution : Since in denominator the power of s is one i.e.m=1,henece its type one system\n");
+printf("c) G(s)=20*(s+2)/(s^3*(s+2)*(s^2+5*s+5) \n solution : Since in denominator the power of s is three i.e.m=3,henece its type three system\n");
+printf("d) G(s)=K/(s*(s+1)*(s+2) \n solution : Since in denominator the power of s is one i.e.m=1,henece its type one system\n");
diff --git a/1151/CH3/EX3.8/example8.sce b/1151/CH3/EX3.8/example8.sce new file mode 100755 index 000000000..8572fbdca --- /dev/null +++ b/1151/CH3/EX3.8/example8.sce @@ -0,0 +1,52 @@ +s=%s
+p= poly([0 0 1],'s','coeff');
+q= poly([1 2 3 2],'s','coeff');
+M=p/q
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R;
+ kp=(1-Ess)/Ess;
+disp (Ess ," f o r u n i t s t e p input Ess=")
+disp(kp,"Kp=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Es s=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H;
+kv=1/Ess;
+disp (Ess ," f o r u n i t ramp input Es s=")
+disp(kv,"Kv=")
+ else printf (" f o r u n i t ramp input Es s=i n f \nn")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" f o r u n i t p a r a b o l i c input Es s=0 \nn")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H;
+ka=1/Ess;
+ disp (Ess ," f o r u n i t p a r a b o l i c input Es s=")
+ diisp(ka,"Ka=")
+ else printf (" f o r u n i t p a r a b o l i c input Es s=i n f \nn")
+ end
+ end
diff --git a/1151/CH3/EX3.9/example9.sce b/1151/CH3/EX3.9/example9.sce new file mode 100755 index 000000000..75f107ad9 --- /dev/null +++ b/1151/CH3/EX3.9/example9.sce @@ -0,0 +1,52 @@ +s=%s
+p= poly([0 0 20],'s','coeff');
+q= poly([1 2 22 4 4 0],'s','coeff');
+M=p/q
+ disp (M,"M( s )=")
+ H =1;
+ R =1;
+ b= coeff (p)
+a= coeff (q)
+// s t e p input
+if (a(1 ,1) ==b(1 ,1)) then
+ printf (" f o r u n i t s t e p input Ess=0 \nn" )
+ else
+ Ess =1/ H*(1 -(b(1 ,1)*H/a(1 ,1)))*R;
+ kp=(1-Ess)/Ess;
+disp (Ess ," f o r u n i t s t e p input Ess=")
+disp(kp,"Kp=")
+ end
+// ramp input
+ c=0
+ for i =1:2
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+ end
+end
+if(c ==2)
+printf (" f o r u n i t ramp input Es s=0 \nn")
+else if(c ==1) then
+Ess =(a(1 ,2) -b(1 ,2)*H)/a(1 ,1)*H;
+kv=1/Ess;
+disp (Ess ," for unitramp input Es s=")
+disp(kv,"Kv=")
+ else printf (" for unit ramp input Ess=infinite \nn")
+ end
+ end
+// p a r a b o l i c input
+c=0
+for i =1:3
+if(a(1,i)-b(1,i)*H ==0) then
+c=c+1
+end
+end
+if(c ==3)
+printf (" for unit parabolic input Ess=0 \nn")
+ else if(c ==2) then
+Ess =(a(1 ,3) -b(1 ,3)*H)/a(1 ,1)*H;
+ka=1/Ess;
+ disp (Ess ," for unit parabolic input Ess=")
+ diisp(ka,"Ka=")
+ else printf (" for unit parabolic input Ess=infinite \nn")
+ end
+ end
diff --git a/1151/CH4/EX4.1/example.sce b/1151/CH4/EX4.1/example.sce new file mode 100755 index 000000000..7bfde7a26 --- /dev/null +++ b/1151/CH4/EX4.1/example.sce @@ -0,0 +1,21 @@ + // bode p l o t is given in the question we have to find transfer function
+s=%s;
+sys = syslin('c',20*s/((s+1)*(s +10)))
+bode(sys)
+show_margins (sys ,'bode')
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
+printf("a) First line has a slope of 20 db/decade indicating a term in numerator ");
+printf("b) At w=1 rad/sec slope changes from +20 db/decade to 0 db/decade indicating a term (s+1)in denominator(net change 0 bd/decade)");
+printf("c) At w=10 rad/sec slope changes from 0 db/decade to- 20b/decade indicating a term (1+s/10)in denominator");
+printf("e) its also mention 20 logK=6")
+k=2;
+disp(K,"K=");
+printf("the given transfer function is G(s)=20*s/((s+1)*(s +10)))");
diff --git a/1151/CH4/EX4.10/example10.sce b/1151/CH4/EX4.10/example10.sce new file mode 100755 index 000000000..2e843ecff --- /dev/null +++ b/1151/CH4/EX4.10/example10.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',1000/(s*(0.1*s +1)*(0.001*s +1)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.11/example11.sce b/1151/CH4/EX4.11/example11.sce new file mode 100755 index 000000000..5a940b02e --- /dev/null +++ b/1151/CH4/EX4.11/example11.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',16*(1+0.5*s)/(s^2*(0.125*s +1)*(0.1*s +1)))
+bode(sys)
+show_margins (sys ,' bode ' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.12/example12.sce b/1151/CH4/EX4.12/example12.sce new file mode 100755 index 000000000..5ec83ef3c --- /dev/null +++ b/1151/CH4/EX4.12/example12.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',50/(s*(0.25*s +1)*(0.1*s +1)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.13/example13.sce b/1151/CH4/EX4.13/example13.sce new file mode 100755 index 000000000..d589fa988 --- /dev/null +++ b/1151/CH4/EX4.13/example13.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',23.7*(1+s)*(1+0.2*s)/(s*(0.1*s +1)*(3*s +1)*(1+0.5*s)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.14/example14.sce b/1151/CH4/EX4.14/example14.sce new file mode 100755 index 000000000..16dbf1a7a --- /dev/null +++ b/1151/CH4/EX4.14/example14.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',512*(s+3)/(s*(s^2+16*s+256)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.15/example15.sce b/1151/CH4/EX4.15/example15.sce new file mode 100755 index 000000000..58890eaf4 --- /dev/null +++ b/1151/CH4/EX4.15/example15.sce @@ -0,0 +1,27 @@ + // bode p l o t is given already in the question w have to solve the folowing parts
+s=%s;
+sys = syslin('c',10^5/((0.2*s+1)*(0.025*s +1)*(0.01*s +1)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
+printf("a) At w=5 rad/sec slope changes -20 db/decade indicating a term (1+s/5)or(1+0.2*s)in denominator");
+printf("b) At w=40 rad/sec slope changes -60 db/decade indicating a term (1+s/40)^2in denominator(net change -40 bd/decade)");
+printf("c) At w=100 rad/sec slope changes - d80b/decade indicating a term (1+s/100)or(1+0.01*s)in denominator");
+printf("d) its also mention 20 logK=100")
+k=10^5;
+disp(K,"K=");
+printf("the given transfer function is G(s)=10^5/((0.2*s+1)*(0.025*s +1)*(0.01*s +1))");
+p1=-(atan(5*0.2)+2*atan(0.025*5)+atan(0.01*5));
+p2=-(atan(40*0.2)+2*atan(0.025*40)+atan(0.01*40));
+p3=-(atan(100*0.2)+2*atan(0.025*100)+atan(0.01*100));
+disp(p1," at w=5 rad /sec phase change is");
+disp(p2," at w=40 rad /sec phase change is");
+disp(p3," at w=5 rad /sec phase change is");
diff --git a/1151/CH4/EX4.16/example16.sce b/1151/CH4/EX4.16/example16.sce new file mode 100755 index 000000000..29b86c783 --- /dev/null +++ b/1151/CH4/EX4.16/example16.sce @@ -0,0 +1,22 @@ + // bode p l o t is given in the question we have to find transfer function
+s=%s;
+sys = syslin('c',48/(s*(s +20)*(s^2+2.52*s +16)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
+printf("a) At w=1 rad/sec slope changes -20 db/decade indicating a term K/s \n");
+printf("b) At w=4 rad/sec slope changes from -20 db/decade to -60 db/decade indicating a term (1+2d/w*s+s^2/w^2)in denominator(net change -40 bd/decade)\n ");
+printf("c) At w=10 rad/sec slope changes from -60 db/decade to- 40b/decade indicating a term (1+s/10)in numerator\n");
+printf("d) At w=20 rad/sec slope changes from --40 db/decade to- -60b/decade indicating a term (1+s/20)in denominator\n");
+printf("e) its also mention 20 logK=3.521")
+k=1.5;
+disp(K,"K=");
+printf("the given transfer function is G(s)=48/(s*(s +20)*(s^2+2.52*s +16))");
diff --git a/1151/CH4/EX4.17/example17.sce b/1151/CH4/EX4.17/example17.sce new file mode 100755 index 000000000..23ffc89b9 --- /dev/null +++ b/1151/CH4/EX4.17/example17.sce @@ -0,0 +1,21 @@ + // bode p l o t is given in the question we have to find transfer function
+s=%s;
+sys = syslin('c',20*s/((s+1)*(s +10)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
+printf("a) First line has a slope of 20 db/decade indicating a term in numerator \n");
+printf("b) At w=1 rad/sec slope changes from +20 db/decade to 0 db/decade indicating a term (s+1)in denominator(net change 0 bd/decade)\n");
+printf("c) At w=10 rad/sec slope changes from 0 db/decade to- 20b/decade indicating a term (1+s/10)in denominator\n");
+printf("e) its also mention 20 logK=6\n")
+k=2;
+disp(K,"K=");
+printf("the given transfer function is G(s)=20*s/((s+1)*(s +10)))\n");
diff --git a/1151/CH4/EX4.18/example18.sce b/1151/CH4/EX4.18/example18.sce new file mode 100755 index 000000000..014d5efc6 --- /dev/null +++ b/1151/CH4/EX4.18/example18.sce @@ -0,0 +1,13 @@ +// given g(s)=100/s(s+6.54)
+printf("given G(s)=g(s)=100/s(s+6.54) \n H(s)=1 \n C(s)/R(s)=G(s)/(1+G(s)*H(s)) \n =100/(s^2+6.54*s+100)");
+printf("compare with w^2/(s^2+2*d*w*s+w^2)");
+w=sqrt(100);
+d=6.54/(2*w);
+wr=w*sqrt(1-2*d^2);
+mr=1/(2*d*sqrt(1-d^2));
+b=w*sqrt(1-2*d^2+sqrt(2-4*d^2+4*d^4));
+disp(w,"undamped natural frequency (in rad/sec)=")
+disp(d,"damping ratio=")
+disp(wr,"resonant frequency (in rad/sec)=")
+disp(mr,"resonance peak=")
+disp(b,"bandwidth of closed loop system(in rad/sec)=")
diff --git a/1151/CH4/EX4.19/example19.sce b/1151/CH4/EX4.19/example19.sce new file mode 100755 index 000000000..fbaf74fd2 --- /dev/null +++ b/1151/CH4/EX4.19/example19.sce @@ -0,0 +1,10 @@ +//givenC(s)/R(s)=G(s)/(1+G(s)*H(s))=w^2/(s^2+2*d*w*s+w^2)
+printf("given R(s)=G(s)/(1+G(s)*H(s))=w^2/(s^2+2*d*w*s+w^2)\n its also given maximum overshoot should not exceed 30 percent ");
+d1=log(0.3);
+d=sqrt(d1^2/(d1^2+%pi^2));
+mr=1/(2*d*sqrt(1-d^2));
+w=10;
+b=w*sqrt(1-2*d^2+sqrt(2-4*d^2+4*d^4));
+disp(d,"damping ratio=")
+disp(mr,"resonance peak=")
+disp(b,"bandwidth of closed loop system(in rad/sec)=")
diff --git a/1151/CH4/EX4.20/example20.sce b/1151/CH4/EX4.20/example20.sce new file mode 100755 index 000000000..aa7395b6f --- /dev/null +++ b/1151/CH4/EX4.20/example20.sce @@ -0,0 +1,12 @@ +//find %overshoot and peak time
+printf("given mr=1.4 and wr=3 rad/sec");
+p1=poly([1 -1 0.1275],'x','c')
+r=roots(p1)
+disp(r)
+d=sqrt(0.1505)
+mo=exp((-%pi*d)/sqrt(1-d^2))*100;
+disp(mo,"maximum overshoot(in %)")
+wr=3
+w=wr/sqrt(1-2*d^2);
+pt=%pi/(w*sqrt(1-d^2));
+disp(pt,"peak time (in sec)=");
diff --git a/1151/CH4/EX4.21/example21.sce b/1151/CH4/EX4.21/example21.sce new file mode 100755 index 000000000..962d7bcf0 --- /dev/null +++ b/1151/CH4/EX4.21/example21.sce @@ -0,0 +1,14 @@ + // bode p l o t
+s=%s;
+sys = syslin('c',10/(s*(0.2*s +1)*(0.05*s +1)))
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.22/example22.sce b/1151/CH4/EX4.22/example22.sce new file mode 100755 index 000000000..434847bca --- /dev/null +++ b/1151/CH4/EX4.22/example22.sce @@ -0,0 +1,6 @@ +printf("given G(s)H(s)=(as+1)/s^2 \n we have to find the value of a for which phase margin is 45 degree\n");
+printf("G(jw)H(jw)=(1+ajw)/(jw)^2 and <G(jw))H(jw)=-180+atan aw\n")
+aw=tan(45);
+a=sqrt(1/sqrt(2));
+printf("the value of a is");
+disp(a);
diff --git a/1151/CH4/EX4.23/example23.sce b/1151/CH4/EX4.23/example23.sce new file mode 100755 index 000000000..46a5faee8 --- /dev/null +++ b/1151/CH4/EX4.23/example23.sce @@ -0,0 +1,14 @@ + // bode p l o t %e^(-0.3*s)/(s*(1+s)
+s=%s;
+sys = syslin('c',1/(s*(1+s))) //%e^(-0.3*s) has no effect on bode plot
+bode(sys)
+show_margins (sys ,'bode' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" system is unstable ")
+else
+printf (" system is stable ")
+end
diff --git a/1151/CH4/EX4.9/example9.sce b/1151/CH4/EX4.9/example9.sce new file mode 100755 index 000000000..eabe34b97 --- /dev/null +++ b/1151/CH4/EX4.9/example9.sce @@ -0,0 +1,14 @@ +// bode p l o t
+s=%s;
+sys = syslin('c',2500/(s*(s +5)*(s +50)))
+bode(sys)
+show_margins (sys ,' bode ' )
+gm= g_margin (sys)
+pm= p_margin (sys)
+disp (gm ," g a in margin=")
+disp (pm ," phas e margin=")
+if (gm <=0 | pm <=0)
+printf (" sys t em i s u n s t a b l e ")
+else
+printf (" sys t em i s s t a b l e ")
+end
diff --git a/1151/CH5/EX5.1/example1.sce b/1151/CH5/EX5.1/example1.sce new file mode 100755 index 000000000..eec217369 --- /dev/null +++ b/1151/CH5/EX5.1/example1.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+4)*(s+5);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.10/example10.sce b/1151/CH5/EX5.10/example10.sce new file mode 100755 index 000000000..de5e587ba --- /dev/null +++ b/1151/CH5/EX5.10/example10.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+6)*(s^2+4*s+13);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.11/example11.sce b/1151/CH5/EX5.11/example11.sce new file mode 100755 index 000000000..49cdbcce8 --- /dev/null +++ b/1151/CH5/EX5.11/example11.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+4)*(s^2+4*s+20);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.12/example12.sce b/1151/CH5/EX5.12/example12.sce new file mode 100755 index 000000000..f3ea61d13 --- /dev/null +++ b/1151/CH5/EX5.12/example12.sce @@ -0,0 +1,7 @@ +s=%s;
+num=s+1;
+den=s*(s-1);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.13/example13.sce b/1151/CH5/EX5.13/example13.sce new file mode 100755 index 000000000..49cdbcce8 --- /dev/null +++ b/1151/CH5/EX5.13/example13.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+4)*(s^2+4*s+20);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.14/example14.sce b/1151/CH5/EX5.14/example14.sce new file mode 100755 index 000000000..4ff0d625b --- /dev/null +++ b/1151/CH5/EX5.14/example14.sce @@ -0,0 +1,7 @@ +s=%s;
+num=(s^2+6*s+10);
+den=(s^2+2*s+10);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.15/example15.sce b/1151/CH5/EX5.15/example15.sce new file mode 100755 index 000000000..494d74172 --- /dev/null +++ b/1151/CH5/EX5.15/example15.sce @@ -0,0 +1,7 @@ +s=%s;
+num=(s+12);
+den=s*s*(s+20);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.16/example16.sce b/1151/CH5/EX5.16/example16.sce new file mode 100755 index 000000000..1c2cd5a68 --- /dev/null +++ b/1151/CH5/EX5.16/example16.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s^2+6*s+12);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.17/example17.sce b/1151/CH5/EX5.17/example17.sce new file mode 100755 index 000000000..95e0e90ee --- /dev/null +++ b/1151/CH5/EX5.17/example17.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s^2+6*s+10);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.18/example19.sce b/1151/CH5/EX5.18/example19.sce new file mode 100755 index 000000000..a5da3d30c --- /dev/null +++ b/1151/CH5/EX5.18/example19.sce @@ -0,0 +1,7 @@ +s=%s;
+num=(s^2-2*s+5);
+den=(s^2+1.5*s-1);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.2/example3.sce b/1151/CH5/EX5.2/example3.sce new file mode 100755 index 000000000..d64c28653 --- /dev/null +++ b/1151/CH5/EX5.2/example3.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s^2+4*s+8);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.3/example3.sce b/1151/CH5/EX5.3/example3.sce new file mode 100755 index 000000000..d64c28653 --- /dev/null +++ b/1151/CH5/EX5.3/example3.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s^2+4*s+8);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.4/example4.sce b/1151/CH5/EX5.4/example4.sce new file mode 100755 index 000000000..e3daacb41 --- /dev/null +++ b/1151/CH5/EX5.4/example4.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+1)*(s^2+4*s+5);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.5/example5.sce b/1151/CH5/EX5.5/example5.sce new file mode 100755 index 000000000..377cbe4ab --- /dev/null +++ b/1151/CH5/EX5.5/example5.sce @@ -0,0 +1,7 @@ +s=%s;
+num=s+1;
+den=s*s*(s+3.6);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.6/example6.sce b/1151/CH5/EX5.6/example6.sce new file mode 100755 index 000000000..255042b4c --- /dev/null +++ b/1151/CH5/EX5.6/example6.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s^2+4*s+13);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.7/example7.sce b/1151/CH5/EX5.7/example7.sce new file mode 100755 index 000000000..8f90fdd91 --- /dev/null +++ b/1151/CH5/EX5.7/example7.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+2)*(s+4);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.8/example8.sce b/1151/CH5/EX5.8/example8.sce new file mode 100755 index 000000000..8f90fdd91 --- /dev/null +++ b/1151/CH5/EX5.8/example8.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+2)*(s+4);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH5/EX5.9/example9.sce b/1151/CH5/EX5.9/example9.sce new file mode 100755 index 000000000..f3ea61d13 --- /dev/null +++ b/1151/CH5/EX5.9/example9.sce @@ -0,0 +1,7 @@ +s=%s;
+num=s+1;
+den=s*(s-1);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH6/EX6.1/example1.sce b/1151/CH6/EX6.1/example1.sce new file mode 100755 index 000000000..de96b9368 --- /dev/null +++ b/1151/CH6/EX6.1/example1.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+6*s^2+4*s +1;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf (" sys t em i s s t a b l e ")
+end
diff --git a/1151/CH6/EX6.10/example10.sce b/1151/CH6/EX6.10/example10.sce new file mode 100755 index 000000000..69ada3df0 --- /dev/null +++ b/1151/CH6/EX6.10/example10.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s ^5+2*s ^4+24*s^3+48*s^2-25*s-50;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m)
+disp (routh ," r o u t h s t a b u l a t i o n s=")
+c =0;
+for i =1: n
+ if ( routh (i ,1) <0)
+c=c+1;
+ end
+ end
+if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf (" sys t em i s ma r g i n a l l y s t a b l e ")
+ end
diff --git a/1151/CH6/EX6.11/example11.sce b/1151/CH6/EX6.11/example11.sce new file mode 100755 index 000000000..d2e3bdec6 --- /dev/null +++ b/1151/CH6/EX6.11/example11.sce @@ -0,0 +1,23 @@ +// d e t e rmi n i n g c r i t i c a l v a l u e o f K
+s=%s
+syms K
+m=s ^3+6.5* s ^2+10* s +10* K
+cof_a_0 = coeffs (m, ' s ' ,0);
+cof_a_1 = coeffs (m, ' s ' ,1);
+cof_a_2 = coeffs (m, ' s ' ,2);
+cof_a_3 = coeffs (m, ' s ' ,3);
+ r=[ cof_a_0 cof_a_1 cof_a_2 cof_a_3 ]
+ n= length (r);
+ routh =[r ([4 ,2]) ;r ([3 ,1]) ];
+routh =[ routh ;- det ( routh )/ routh (2 ,1) ,0];
+t= routh (2:3 ,1:2) ; // e x t r a c t i n g the s qu a r e sub b l o c ko f r outh mat r ix
+ routh =[ routh ;- det (t)/t(2 ,1) ,0]
+disp (routh ," r o u t h s t a b u l a t i o n=")
+routh (3 ,1) =0 // For ma r g ina ly s t a b l e sys t em
+sys = syslin ( ' c ' ,10/(s ^3+6.5* s ^2+10* s ))
+k= kpure ( sys )
+disp (k,"K( ma r g ina l )=")
+disp ( '=0 ' ,routh (2 ,1) *(s^2) +1.5*10^7*k," a u x i l l a r y e q u a t i o n ")
+p= poly ([ 10* K,0 ,6.5] , ' s ' , ' c o e f f ' )
+s= roots (p)
+disp (s," Fr equency o f o s c i l l a t i o n ( i n rad / s e c )=")
diff --git a/1151/CH6/EX6.12/example12.sce b/1151/CH6/EX6.12/example12.sce new file mode 100755 index 000000000..ff846183c --- /dev/null +++ b/1151/CH6/EX6.12/example12.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^3+7*s^2+25*s+39;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf (" sys t em i s s t a b l e ")
+end
diff --git a/1151/CH6/EX6.13/example13.sce b/1151/CH6/EX6.13/example13.sce new file mode 100755 index 000000000..ce50f5449 --- /dev/null +++ b/1151/CH6/EX6.13/example13.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+8*s^2+4*s +3;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.14/example14.sce b/1151/CH6/EX6.14/example14.sce new file mode 100755 index 000000000..7407ef0aa --- /dev/null +++ b/1151/CH6/EX6.14/example14.sce @@ -0,0 +1,34 @@ + s=%s;
+ syms K
+ p=s^2 -(K +2) *s +((2* K) +5)
+cof_a_0 = coeffs (p, ' s ' ,0);
+ cof_a_1 = coeffs (p, ' s ' ,1);
+ cof_a_2 = coeffs (p, ' s ' ,2);
+ r=[ cof_a_0 cof_a_1 cof_a_2 ]
+ n= length (r);
+routh =[r ([3 ,1]) ;r (2) ,0];
+routh =[ routh ;- det ( routh )/ routh (2 ,1) ,0];
+ disp (routh ," r outh=")
+// f o r sys t em to be s t a b l e
+ routh (2 ,1) >0
+
+ K < -2;
+ routh (3 ,1) >0
+K > -2.5;
+disp ("For s t a b l e sys tem , 2>K>2.5")
+ // f o r l imi t e d s t a b i l i t y
+routh (2 ,1) =0
+ K=-2
+ routh (3 ,1) =0
+ K= -2.5
+ disp ("For l imt e d s t a b l e sys t em K=2 and K=2.5")
+ // f o r u n s t a b l e sys t em
+ disp ("For u n s t a b l e sys t em K<2 or K>2.5")
+ roots (p) // g i v e s the r o o t s o f the po l ynomi a l m
+// f o r c r i t i c a l l y damped c a s e
+28 g=(K+2) ^2 -4*((2* K) +5)
+ roots (g)
+ // f o r s t a b l i t y K=6.47 i s u n s t a b l e
+ // f o r c r i t i c a l damping K=2.47
+ disp ("For underdamded cas e , 2>K>2.47")
+disp (" f o r overdamped cas e , 2.47>K>2.5")
diff --git a/1151/CH6/EX6.15/example15.sce b/1151/CH6/EX6.15/example15.sce new file mode 100755 index 000000000..99f283036 --- /dev/null +++ b/1151/CH6/EX6.15/example15.sce @@ -0,0 +1,29 @@ +s=%s;
+ syms K a
+ p=s ^4+10* s ^3+32* s ^2+( K +32) *s+(K*a)
+cof_a_0 = coeffs (p, ' s ' ,0);
+cof_a_1 = coeffs (p, ' s ' ,1);
+ cof_a_2 = coeffs (p, ' s ' ,2);
+cof_a_3 = coeffs (p, ' s ' ,3);
+ cof_a_4 = coeffs (p, ' s ' ,4);
+r=[ cof_a_0 cof_a_1 cof_a_3 cof_a_4 ]
+ n= length (r);
+ routh =[r ([5 ,3 ,1]) ;r ([4 ,2]) ,0]
+routh =[ routh ;- det ( routh (1:2 ,1:2) )/ routh (2 ,1) ,-det (routh (1:2 ,2:3) )/ routh (2 ,2) ,0];
+routh =[ routh ;- det ( routh (2:3 ,1:2) )/ routh (3 ,1) ,-det (routh (2:3 ,2:3) )/ routh (3 ,2) ,0];
+routh =[ routh ;- det ( routh (3:4 ,1:2) )/ routh (4 ,1) ,0 ,0];
+disp (routh ," r outh=")
+// f o r the g i v e n sys t em to be s t a b l e
+routh (3 ,1) >0
+K <288;
+routh (4 ,1) >0
+(288 -K)*(K +32) -100(K*a) >0
+// l e t K=200
+K =200;
+a =((288 - K)*(K +32) ) /(100* K)
+// v e l o c i t y e r r o r
+Kv =(K*a) /(4*2*4) ;
+// % v e l o c i t y e r r o r
+Kvs =100/ Kv
+disp (a," c o n t r o l parame t e r=")
+disp (K,"Gain=")
diff --git a/1151/CH6/EX6.16/example16.sce b/1151/CH6/EX6.16/example16.sce new file mode 100755 index 000000000..ce50f5449 --- /dev/null +++ b/1151/CH6/EX6.16/example16.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+8*s^2+4*s +3;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.17/example17.sce b/1151/CH6/EX6.17/example17.sce new file mode 100755 index 000000000..ce50f5449 --- /dev/null +++ b/1151/CH6/EX6.17/example17.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+8*s^2+4*s +3;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.18/example18.sce b/1151/CH6/EX6.18/example18.sce new file mode 100755 index 000000000..79714d001 --- /dev/null +++ b/1151/CH6/EX6.18/example18.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+s^2+4*s +2;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.19/exmple19.sce b/1151/CH6/EX6.19/exmple19.sce new file mode 100755 index 000000000..065bf8141 --- /dev/null +++ b/1151/CH6/EX6.19/exmple19.sce @@ -0,0 +1,18 @@ + // e l eme n t s i n one row o f r o u t h s t a b u l a t i o n s a r e a l lz e r o
+s=%s;
+m=s^6+3*s ^5+5* s ^4+9* s ^3+8* s ^2+6* s +4;
+disp (m)
+ r= coeff (m)
+ n= length (r)
+ routh = routh_t (m)
+ disp (routh ," r o u t h s t a b u l a t i o n s=")
+ c =0;
+for i =1: n
+ if ( routh (i ,1) <0)
+ c=c+1;
+end
+ end
+ if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf("system is marginally stable")
+end
diff --git a/1151/CH6/EX6.2/example2.sce b/1151/CH6/EX6.2/example2.sce new file mode 100755 index 000000000..1c16de6eb --- /dev/null +++ b/1151/CH6/EX6.2/example2.sce @@ -0,0 +1,17 @@ +s=%s;
+m=2+3*s+s^2+2*s^3+2*s^4;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf (" sys t em i s s t a b l e ")
+end
diff --git a/1151/CH6/EX6.20/example20.sce b/1151/CH6/EX6.20/example20.sce new file mode 100755 index 000000000..e87195501 --- /dev/null +++ b/1151/CH6/EX6.20/example20.sce @@ -0,0 +1,7 @@ +s=%s;
+num=1;
+den=s*(s+2)*(s^2+6*s+25);
+t=syslin('c',num/den);
+clf;
+evans(t);
+mtlb_axis([-5 5 -5 5]);
diff --git a/1151/CH6/EX6.3/example3.sce b/1151/CH6/EX6.3/example3.sce new file mode 100755 index 000000000..80a4e32da --- /dev/null +++ b/1151/CH6/EX6.3/example3.sce @@ -0,0 +1,17 @@ +s=%s;
+m=1+2*s+5*s^2+5*s^3+2*s^4;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" sys t em i s u n s t a b l e ")
+else printf (" sys t em i s s t a b l e ")
+end
diff --git a/1151/CH6/EX6.4/example4.sce b/1151/CH6/EX6.4/example4.sce new file mode 100755 index 000000000..160608b2c --- /dev/null +++ b/1151/CH6/EX6.4/example4.sce @@ -0,0 +1,17 @@ +s=%s;
+m=s^4+2*s^3+3*s^2+4*s +5;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.5/example5.sce b/1151/CH6/EX6.5/example5.sce new file mode 100755 index 000000000..e0de7a8cf --- /dev/null +++ b/1151/CH6/EX6.5/example5.sce @@ -0,0 +1,17 @@ +clc;s=%s;
+m=s^3+4.5*s^2+3.5*s +1.5;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.6/example6.sce b/1151/CH6/EX6.6/example6.sce new file mode 100755 index 000000000..faa5ef468 --- /dev/null +++ b/1151/CH6/EX6.6/example6.sce @@ -0,0 +1,17 @@ +clc;s=%s;
+m=s^5+6*s^4+3*s^3+2*s^2+s+1;
+disp (m)
+r= coeff (m)
+n= length (r)
+routh = routh_t (m) // Thi s Func t ion g e n e r a t e s the Routht a b l e
+disp (routh ," r o u t h s t a b u l a t i o n=")
+c =0;
+for i =1: n
+if ( routh (i ,1) <0)
+c=c+1;
+end
+end
+if(c >=1)
+printf (" system is unstable ")
+else printf (" system is stable ")
+end
diff --git a/1151/CH6/EX6.7/example7.sce b/1151/CH6/EX6.7/example7.sce new file mode 100755 index 000000000..c634a2606 --- /dev/null +++ b/1151/CH6/EX6.7/example7.sce @@ -0,0 +1,8 @@ +// f i r s t e l ement i n any row o f r o u t h s t a b u l a t i o n i s z e r o
+clc;s=%s
+m=s^4+s ^3+2* s ^2+2* s+3
+r= coeff (m); // Ex t r a c t s the c o e f f i c i e n t o f the po l ynomi a l
+n= length (r);
+routh = routh_t (m)
+disp (routh ," r outh=")
+printf (" since there are two sign changes the system is unstable")
diff --git a/1151/CH6/EX6.8/example8.sce b/1151/CH6/EX6.8/example8.sce new file mode 100755 index 000000000..fbb5ce9f5 --- /dev/null +++ b/1151/CH6/EX6.8/example8.sce @@ -0,0 +1,8 @@ +// f i r s t e l ement i n any row o f r o u t h s t a b u l a t i o n i s z e r o
+clc;s=%s
+m=s^5+2*s^4+2*s^3+4*s^2+11*s+10;
+r= coeff (m); // Ex t r a c t s the c o e f f i c i e n t o f the po l ynomi a l
+n= length (r);
+routh = routh_t (m)
+disp (routh ," r outh=")
+printf (" since there are two sign changes the system is unstable")
diff --git a/1151/CH6/EX6.9/example9.sce b/1151/CH6/EX6.9/example9.sce new file mode 100755 index 000000000..4b2bd1854 --- /dev/null +++ b/1151/CH6/EX6.9/example9.sce @@ -0,0 +1,8 @@ +// f i r s t e l ement i n any row o f r o u t h s t a b u l a t i o n i s z e r o
+clc;s=%s
+m=s^3+s+1;
+r= coeff (m); // Ex t r a c t s the c o e f f i c i e n t o f the po l ynomi a l
+n= length (r);
+routh = routh_t (m)
+disp (routh ," r outh=")
+printf (" since there are two sign changes the system is unstable")
diff --git a/1151/CH7/EX7.1/example_1.sce b/1151/CH7/EX7.1/example_1.sce new file mode 100755 index 000000000..64ed703a1 --- /dev/null +++ b/1151/CH7/EX7.1/example_1.sce @@ -0,0 +1,8 @@ +s=poly(0,'s')
+h=syslin('c',(1/(s*(1+s))));//assume T=1
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.10/example_10.sce b/1151/CH7/EX7.10/example_10.sce new file mode 100755 index 000000000..ebc3b871a --- /dev/null +++ b/1151/CH7/EX7.10/example_10.sce @@ -0,0 +1,8 @@ +s=%s;
+num=60;
+den=(s+1)*(s+2)*(s+5);
+ansys=syslin('c',(num/den));
+nyquist(ansys,-1,1000);
+printf("No pole on the right half plane i.e.:\n P=0");
+printf(" N=0\n Z=0");
+disp("hence the system is stable")
diff --git a/1151/CH7/EX7.11/example_11.sce b/1151/CH7/EX7.11/example_11.sce new file mode 100755 index 000000000..ce8ba4faa --- /dev/null +++ b/1151/CH7/EX7.11/example_11.sce @@ -0,0 +1,5 @@ +s=%s;
+num=1;
+den=s*(s+2)*(s+10);
+ansys=syslin('c',(num/den));
+nyquist(ansys,-1,1000);
diff --git a/1151/CH7/EX7.2/example_2.sce b/1151/CH7/EX7.2/example_2.sce new file mode 100755 index 000000000..742b9f5f3 --- /dev/null +++ b/1151/CH7/EX7.2/example_2.sce @@ -0,0 +1,8 @@ +s=poly(0,'s')//lets assume T1=1 nad T2=2 and we have considered unity feedback system
+h=syslin('c',1/(s^2+3*s+1));
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.3/example_3.sce b/1151/CH7/EX7.3/example_3.sce new file mode 100755 index 000000000..85b9cbbb8 --- /dev/null +++ b/1151/CH7/EX7.3/example_3.sce @@ -0,0 +1,8 @@ +s=poly(0,'s')
+h=syslin('c',1/(s^2)/(1+s));
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.4/example_4.sce b/1151/CH7/EX7.4/example_4.sce new file mode 100755 index 000000000..08913799c --- /dev/null +++ b/1151/CH7/EX7.4/example_4.sce @@ -0,0 +1,8 @@ +s=poly(0,'s')
+h=syslin('c',1/(2*s^3+3*s^2+s));
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.5/example_5.sce b/1151/CH7/EX7.5/example_5.sce new file mode 100755 index 000000000..61c1b4bb2 --- /dev/null +++ b/1151/CH7/EX7.5/example_5.sce @@ -0,0 +1,10 @@ +s=poly(0,'s')
+a=(s+1)*(s+2)*(s+1.5);//denominator of transfer function
+h=syslin('c',1/a);//here G(s)H(s)is represented by h
+
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.6/example_6.sce b/1151/CH7/EX7.6/example_6.sce new file mode 100755 index 000000000..2bec3798e --- /dev/null +++ b/1151/CH7/EX7.6/example_6.sce @@ -0,0 +1,12 @@ +s=poly(0,'s')
+a=(1+4*s);
+b=s^2*(1+s)*(1+2*s);
+d=a/b;
+h=syslin('c',d);
+clf();
+nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.7/example_7.sce b/1151/CH7/EX7.7/example_7.sce new file mode 100755 index 000000000..a334bc29a --- /dev/null +++ b/1151/CH7/EX7.7/example_7.sce @@ -0,0 +1,8 @@ +s=poly(0,'s')
+h=syslin('c',1/(s*(1+2*s)*(1+s)));
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
diff --git a/1151/CH7/EX7.8/example_8.sce b/1151/CH7/EX7.8/example_8.sce new file mode 100755 index 000000000..d145a3358 --- /dev/null +++ b/1151/CH7/EX7.8/example_8.sce @@ -0,0 +1,10 @@ +s=poly(0,'s')
+h=syslin('c',1/((s+1)*(s+2)*(s+3)));
+clf(); nyquist(h)
+// add a datatip
+ax=gca();
+h_h=ax.children($).children(2);//handle on Nyquist curve of h
+tip=datatipCreate(h_h,[1.331,0.684]);
+datatipSetOrientation(tip,"upper left");
+k=kpure(h)
+disp(k,"the system is stable for0 <k<");
diff --git a/1151/CH7/EX7.9/example_9.sce b/1151/CH7/EX7.9/example_9.sce new file mode 100755 index 000000000..87a4193ae --- /dev/null +++ b/1151/CH7/EX7.9/example_9.sce @@ -0,0 +1,11 @@ +s=%s;
+num=(1-s);
+den=(s+1);
+ansys=syslin('c',(num/den));
+nyquist(ansys,-1,1000);
+printf("When K>1:nobopen loop pole is on right half of the s plane P=0");
+printf("number of encirclement of point(-1+j0)N=1\n N=Z-P\n1=Z-0\n Z=1");
+printf("hence the system is unstable")
+printf("When K<1: P=0");
+printf(" N=0\n Z=0");
+printf("hence the system is stable")
diff --git a/1151/CH8/EX8.1/example1.sce b/1151/CH8/EX8.1/example1.sce new file mode 100755 index 000000000..23990970a --- /dev/null +++ b/1151/CH8/EX8.1/example1.sce @@ -0,0 +1,7 @@ +printf("given the differential equation \n let select the state variables as x1=y,x2=y(dot),x3=y(double dot)")
+a=[0 1 0;0 0 1;-10 -11 -6]
+b=[0;0;8]
+
+disp("x(t)=[x1;x2;x3]")
+disp(a,"A=")
+disp(b,"B=")
diff --git a/1151/CH8/EX8.10/example10.sce b/1151/CH8/EX8.10/example10.sce new file mode 100755 index 000000000..fe885f0a5 --- /dev/null +++ b/1151/CH8/EX8.10/example10.sce @@ -0,0 +1,20 @@ +A =[-1 0 0;0 -2 0;0 0 -3]
+B =[1;1;0]
+x=[0 1 2]
+p=cont_mat(A,B)
+disp (p," controllability matrix=");
+d=det(p)
+if d==0
+printf ("matrix is singular, so the system is uncontrollable");
+else
+printf ("system is controllable ");
+end
+s=%s
+[r c]= size (A)
+h=s*eye(r,c)-A // s*I-A
+q=inv(h)
+c=x*q*B;
+disp(c,"required transfer function =")
+
+
+
diff --git a/1151/CH8/EX8.11/example11.sce b/1151/CH8/EX8.11/example11.sce new file mode 100755 index 000000000..142e3c5d9 --- /dev/null +++ b/1151/CH8/EX8.11/example11.sce @@ -0,0 +1,21 @@ +A =[-0.5 0;0 -2]
+B =[0;1]
+C=[0 1]
+p=cont_mat(A,B)
+disp (p," controllability matrix=");
+d=det(p)
+if d==0
+printf ("matrix is singular, so the system is uncontrollable");
+else
+printf ("system is controllable ");
+end
+g= obsv_mat (A,C);
+disp (g," Observability Matrix=");
+i= det(g)
+if i ==0
+printf ("matrix is singular, so the system is unobservable");
+else
+printf (" system is observable ");
+end
+
+
diff --git a/1151/CH8/EX8.14/example14.sce b/1151/CH8/EX8.14/example14.sce new file mode 100755 index 000000000..d91050edf --- /dev/null +++ b/1151/CH8/EX8.14/example14.sce @@ -0,0 +1,6 @@ +s=%s ;//convert to state space
+K=1;
+TFcont=syslin ('c',K/(s ^4+3*s^3+3*s^2+3*s+2))
+SScont=tf2ss (TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont( 2 ) , SScont( 3 ) )
+disp(SScont)
diff --git a/1151/CH8/EX8.15/example15.sce b/1151/CH8/EX8.15/example15.sce new file mode 100755 index 000000000..0f5320d4d --- /dev/null +++ b/1151/CH8/EX8.15/example15.sce @@ -0,0 +1,5 @@ +s=%s ;// convert to state space
+
+TFcont=syslin ('c',20*(10*s+1)/(s^3+3*s^2+2*s+1))
+SScont=tf2ss (TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont( 2 ) , SScont( 3 ) )
diff --git a/1151/CH8/EX8.16/example16.sce b/1151/CH8/EX8.16/example16.sce new file mode 100755 index 000000000..b0c3f5898 --- /dev/null +++ b/1151/CH8/EX8.16/example16.sce @@ -0,0 +1,24 @@ +s=%s ;//convert to state space
+TFcont=syslin ('c',2/(s^3+6*s^2+11*s+6))
+SScont=tf2ss (TFcont)
+[Ac ,Bc ,U, ind ]=canon( SScont( 2 ) , SScont( 3 ) )
+disp(Ac,"A=")
+disp(Bc,"B=")
+C=[1 0 0]
+p=cont_mat(Ac,Bc)
+disp (p," controllability matrix=");
+d=det(p)
+if d==0
+printf ("matrix is singular, so the system is uncontrollable");
+else
+printf ("system is controllable ");
+end
+g= obsv_mat (Ac,C);
+disp (g," Observability Matrix=");
+i= det(g)
+if i ==0
+printf ("matrix is singular, so the system is unobservable");
+else
+printf (" system is observable ");
+end
+
diff --git a/1151/CH8/EX8.17/example17.sce b/1151/CH8/EX8.17/example17.sce new file mode 100755 index 000000000..81b5cee0f --- /dev/null +++ b/1151/CH8/EX8.17/example17.sce @@ -0,0 +1,9 @@ +s=%s;
+A =[-1 1;0 -2];
+B =[1 0 1;0 1 1];
+x =[1 2;1 0;1 1];
+[r c]= size (A)
+p=s*eye(r,c)-A // s*I-A
+q=inv(p)
+c=x*q*B;
+disp(c,"required transfer function =")
diff --git a/1151/CH8/EX8.18/example18.sce b/1151/CH8/EX8.18/example18.sce new file mode 100755 index 000000000..0c1cd75c8 --- /dev/null +++ b/1151/CH8/EX8.18/example18.sce @@ -0,0 +1,7 @@ +s=%s ;// convert to state space
+
+TFcont=syslin ('c',20*(4*s+2)/(s^3+5*s^2+8*s+2))
+SScont=tf2ss (TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont( 2 ) , SScont( 3 ) )
+disp(Ac,"Matrix A=")
+disp(Bc,"Matrix B=")
diff --git a/1151/CH8/EX8.19/example19.sce b/1151/CH8/EX8.19/example19.sce new file mode 100755 index 000000000..d39cce0ca --- /dev/null +++ b/1151/CH8/EX8.19/example19.sce @@ -0,0 +1,9 @@ +s=%s ;// convert to state space
+
+TFcont=syslin ('c',(s+2)/(s^3+3*s^2+2*s+10))
+SScont=tf2ss (TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont( 2 ) , SScont( 3 ) )
+disp(Ac,"Matrix A=")
+disp(Bc,"Matrix B=")
+C=[2 1 0]
+disp(C," Matrix Ct=")
diff --git a/1151/CH8/EX8.2/example2.sce b/1151/CH8/EX8.2/example2.sce new file mode 100755 index 000000000..64aa7a822 --- /dev/null +++ b/1151/CH8/EX8.2/example2.sce @@ -0,0 +1,13 @@ +clear ; clc;
+xdel ( winsid ()); // c l o s e a l l windows
+mode (0)
+x1 = [1; 2; 3]
+x2 = [1; 0; 1]
+x3 = [2; 2; 4]
+A = [x1 x2 x3 ];
+disp (A, ' [ x1 : x2 : x3 ] =' );
+disp ( clean ( det (A)), ' de t ( [ x1 : x2 : x3 ] ) =' ); // s i n g u l a r
+x3 = [2;2;2]
+A = [x1 x2 x3 ];
+disp (A, ' [ x1 : x2 : x3 ] =' );
+disp (det(A), ' de t ( [ x1 : x2 : x3 ] ) =' );
diff --git a/1151/CH8/EX8.20/example20.sce b/1151/CH8/EX8.20/example20.sce new file mode 100755 index 000000000..de1526dd6 --- /dev/null +++ b/1151/CH8/EX8.20/example20.sce @@ -0,0 +1,19 @@ +A=[-1 0 0;0 -2 0;0 0 -3]//controlability and observebility
+B=[1;1;0]
+C=[1 0 2]
+p=cont_mat(A,B)
+disp (p," controllability matrix=");
+d=det(p)
+if d==0
+printf ("matrix is singular, so the system is uncontrollable");
+else
+printf ("system is controllable ");
+end
+g= obsv_mat (A,C);
+disp (g," Observability Matrix=");
+i= det(g)
+if i ==0
+printf ("matrix is singular, so the system is unobservable");
+else
+printf (" system is observable ");
+end
diff --git a/1151/CH8/EX8.21/example21.sce b/1151/CH8/EX8.21/example21.sce new file mode 100755 index 000000000..fa03cc76f --- /dev/null +++ b/1151/CH8/EX8.21/example21.sce @@ -0,0 +1,11 @@ +//check the obersebability of the system
+A=[-1 0;0 -2]
+C=[1 1]
+g= obsv_mat (A,C);
+disp (g," Observability Matrix=");
+i= det(g)
+if i ==0
+printf ("matrix is singular, so the system is unobservable");
+else
+printf (" system is observable ");
+end
diff --git a/1151/CH8/EX8.22/example22.sce b/1151/CH8/EX8.22/example22.sce new file mode 100755 index 000000000..bbe97f347 --- /dev/null +++ b/1151/CH8/EX8.22/example22.sce @@ -0,0 +1,9 @@ +s=%s'
+A =[0 1 0;0 0 1;0 -2 -3]
+B =[0;0;1]
+x=[1 2 0]
+[r c]= size (A)
+h=s*eye(r,c)-A // s*I-A
+q=inv(h)
+c=x*q*B;
+disp(c,"required transfer function =")
diff --git a/1151/CH8/EX8.23/example23.sce b/1151/CH8/EX8.23/example23.sce new file mode 100755 index 000000000..cbce113e2 --- /dev/null +++ b/1151/CH8/EX8.23/example23.sce @@ -0,0 +1,9 @@ +s=%s;//find transfer function of the given system
+A =[-2 -1;-3 -2];
+B =[3;4];
+x =[2 1];
+[r c]= size (A)
+p=s*eye(r,c)-A // s*I-A
+q=inv(p)
+c=x*q*B;
+disp(c,"required transfer function =")
diff --git a/1151/CH8/EX8.25/example25.sce b/1151/CH8/EX8.25/example25.sce new file mode 100755 index 000000000..a72b3b612 --- /dev/null +++ b/1151/CH8/EX8.25/example25.sce @@ -0,0 +1,7 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',(1+0.5*s)/(s^2+2*s+0.5) )
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
+disp(Ac,"MAtrix A=")
+disp(Bc,"MAtrix B=")
diff --git a/1151/CH8/EX8.27/example27.sce b/1151/CH8/EX8.27/example27.sce new file mode 100755 index 000000000..a4dbcf962 --- /dev/null +++ b/1151/CH8/EX8.27/example27.sce @@ -0,0 +1,5 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',(1+0.5*s)/(s^2+2*s+0.5) )
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
diff --git a/1151/CH8/EX8.28/example28.sce b/1151/CH8/EX8.28/example28.sce new file mode 100755 index 000000000..95fbf373a --- /dev/null +++ b/1151/CH8/EX8.28/example28.sce @@ -0,0 +1,7 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',1/(s^3+6*s^2+11*s+6) )
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
+disp(Ac,"MAtrix A=")
+disp(Bc,"MAtrix B=")
diff --git a/1151/CH8/EX8.3/example3.sce b/1151/CH8/EX8.3/example3.sce new file mode 100755 index 000000000..2e7a6c675 --- /dev/null +++ b/1151/CH8/EX8.3/example3.sce @@ -0,0 +1,7 @@ +clear ; clc;
+ xdel ( winsid ()); // c l o s e a l l windows
+ s = %s;
+ num = 25.04* s + 5.008;
+den = poly([5.008 25.1026 5.03247 1],'s','c');
+Hss = cont_frm (num ,den);
+disp (Hss , ' Hss = ' )
diff --git a/1151/CH8/EX8.31/example31.sce b/1151/CH8/EX8.31/example31.sce new file mode 100755 index 000000000..bd280b90d --- /dev/null +++ b/1151/CH8/EX8.31/example31.sce @@ -0,0 +1,5 @@ +//write down dcf of the following state space
+A =[0 1 0;0 0 1; -6 -11 -6]
+T =[1 1 1;-1 -2 -3;1 4 9]
+Adcf =inv(T)*A*T
+disp (Adcf ,"Adcf=")
diff --git a/1151/CH8/EX8.32/example32.sce b/1151/CH8/EX8.32/example32.sce new file mode 100755 index 000000000..a256373ab --- /dev/null +++ b/1151/CH8/EX8.32/example32.sce @@ -0,0 +1,7 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',(s+6)/(s^2+5*s+6))
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
+disp(Ac,"MAtrix A=")
+disp(Bc,"MAtrix B=")
diff --git a/1151/CH8/EX8.33/example33.sce b/1151/CH8/EX8.33/example33.sce new file mode 100755 index 000000000..a347a6fce --- /dev/null +++ b/1151/CH8/EX8.33/example33.sce @@ -0,0 +1,16 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',(s^2+3*s+3)/(s^3+2*s^2+3*s-1))
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
+disp(Ac,"MAtrix A=")
+disp(Bc,"MAtrix B=")
+s=%s;
+A =[0 0 1;1 0 -3;0 1 -2];
+B =[3;3;1];
+x =[0 0 1];
+[r c]= size (A)
+p=s*eye(r,c)-A // s*I-A
+q=inv(p)
+c=x*q*B;
+disp(c,"required transfer function =")
diff --git a/1151/CH8/EX8.34/example34.sce b/1151/CH8/EX8.34/example34.sce new file mode 100755 index 000000000..3bb3caaad --- /dev/null +++ b/1151/CH8/EX8.34/example34.sce @@ -0,0 +1,9 @@ +s=%s ;
+//create state equation of the following matrix
+TFcont=syslin ('c',(s+6)/(s^2+5*s+6))
+SScont=tf2ss(TFcont )
+[Ac ,Bc ,U, ind ]=canon( SScont ( 2 ) , SScont ( 3 ) )
+disp(Ac,"MAtrix A=")
+disp(Bc,"MAtrix B=")
+
+
diff --git a/1151/CH8/EX8.6/example6.sce b/1151/CH8/EX8.6/example6.sce new file mode 100755 index 000000000..a95142ecd --- /dev/null +++ b/1151/CH8/EX8.6/example6.sce @@ -0,0 +1,9 @@ +s=%s;
+A =[0 1;-2 -3];
+B =[0;1];
+x =[1 0];
+[r c]= size (A)
+p=s*eye(r,c)-A // s*I-A
+q=inv(p)
+c=x*q*B;
+disp(c,"required transfer function =")
diff --git a/1151/CH9/EX9.1/example1.sce b/1151/CH9/EX9.1/example1.sce new file mode 100755 index 000000000..245a6d809 --- /dev/null +++ b/1151/CH9/EX9.1/example1.sce @@ -0,0 +1,30 @@ +s=%s;//given Kv=1000sec^-1
+Kv =1000;
+g =Kv/( s*(0.1*s +1)* (1+.001*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 ," g a i n ma r g i n=")
+disp (( freqGM *2* %pi)," =gain margin frequency");
+disp (pm ," phas e margin=")
+disp (( freqPM *2* %pi)," phase margin frequency=");
+printf (" sine the phase margin is less than the desired pahse margin so we need pahse lead compensator ")
+gc =(1+0.016* s) /(1+0.00214* 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;
+ 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 crossover frequency=")
diff --git a/1151/CH9/EX9.2/example2.sce b/1151/CH9/EX9.2/example2.sce new file mode 100755 index 000000000..8ae8a0b9b --- /dev/null +++ b/1151/CH9/EX9.2/example2.sce @@ -0,0 +1,30 @@ +s=%s;
+ K=20;//K=20sec^-1
+g = K/(s*(s+2)*(s+20));
+ G= syslin ('c',g)
+fmin =0.01;
+fmax =100;
+bode (G,fmin , fmax )
+show_margins (G)
+xtitle (" uncompensated sys t em")
+[gm , freqGM ]= g_margin (G)
+[pm , freqPM ]= p_margin (G)
+disp(gm ," gain margin=")
+disp(( freqGM *2* %pi)," g a in margin f r e q=");
+disp(pm ," phase margin=")
+disp(( freqPM *2* %pi)," phas e margin f r e q=");
+disp("since the phase margin is greater than desired phase margin system need lag compensator ")
+gc =(5*s +1) /(1+50*s);
+ Gc= syslin ('c',gc);
+disp (Gc ," transfer function of lag compensator=");
+G1=G*Gc
+disp (G1 ," overall transfer function=");
+fmin =0.01;
+ fmax =100;
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phase margin of compensated system=")
+disp (( freqPM *2* %pi)," gain crossover frequency=")
diff --git a/1151/CH9/EX9.3/example3.sce b/1151/CH9/EX9.3/example3.sce new file mode 100755 index 000000000..b81db06a2 --- /dev/null +++ b/1151/CH9/EX9.3/example3.sce @@ -0,0 +1,33 @@ +s=%s;
+// g i v e n Kv=20 : v e l o c i t y e r r o r c o n s t s n t
+ K =20;
+g =K/(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 ," g a i n ma r g i n=")
+disp (( freqGM *2* %pi)," g a in margin f r e q=");
+disp (pm ," phas e margin=")
+disp (( freqPM *2* %pi)," phas e margin f r e q=");
+disp (" since phase margin is negative system is unstable ")
+disp (" /n hence we use a lead-lag compensator ")
+gc =(0.118*s +1)/(2.039*(1+0.058*s))
+Gc= syslin ('c',gc)
+disp (Gc ," transfer function of lead lag compensator= ")
+G1=G*Gc;
+disp (G1 ," o v e r a l l t r a n s f e r f u n c t i o n=");
+fmin =0.01;
+fmax =100;
+
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phas e margin o f compensated sys t em=")
+disp (( freqPM *2* %pi)," g a in c r o s s ov e r f r e q u e n c y=")
diff --git a/1151/CH9/EX9.4/example4.sce b/1151/CH9/EX9.4/example4.sce new file mode 100755 index 000000000..29065004b --- /dev/null +++ b/1151/CH9/EX9.4/example4.sce @@ -0,0 +1,33 @@ +s=%s;
+// g i v e n Kv=30 sec^-1: v e l o c i t y e r r o r c o n s t s n t
+ K =30;
+g =K/(s (1+0.1*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 ," g a i n ma r g i n=")
+disp (( freqGM *2* %pi)," g a in margin f r e q=");
+disp (pm ," phas e margin=")
+disp (( freqPM *2* %pi)," phas e margin f r e q=");
+disp (" since phase margin is negative system is unstable ")
+disp (" /n hence we use a lead-lag compensator ")
+gc =(3.57*s +1)/(1+35.7*s)
+Gc= syslin ('c',gc)
+disp (Gc ," transfer function of lead lag compensator= ")
+G1=G*Gc;
+disp (G1 ," o v e r a l l t r a n s f e r f u n c t i o n=");
+fmin =0.01;
+fmax =100;
+
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phas e margin o f compensated sys t em=")
+disp (( freqPM *2* %pi)," g a in c r o s s ov e r f r e q u e n c y=")
diff --git a/1151/CH9/EX9.6/example6.sce b/1151/CH9/EX9.6/example6.sce new file mode 100755 index 000000000..87b872331 --- /dev/null +++ b/1151/CH9/EX9.6/example6.sce @@ -0,0 +1,33 @@ +s=%s;
+// g i v e n Ka=10 sec^-1
+ K =10;
+g =K/(s *s*(1+0.25*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 ," g a i n ma r g i n=")
+disp (( freqGM *2* %pi)," g a in margin f r e q=");
+disp (pm ," phas e margin=")
+disp (( freqPM *2* %pi)," phas e margin f r e q=");
+disp (" since phase margin is negative system is unstable ")
+disp (" /n hence we use a lead-lag compensator ")
+gc =(0.374*s +1)^2/(1+0.074*s)^2
+Gc= syslin ('c',gc)
+disp (Gc ," transfer function of lead lag compensator= ")
+G1=G*Gc;
+disp (G1 ," o v e r a l l t r a n s f e r f u n c t i o n=");
+fmin =0.01;
+fmax =100;
+
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phas e margin o f compensated sys t em=")
+disp (( freqPM *2* %pi)," g a in c r o s s ov e r f r e q u e n c y=")
diff --git a/1151/CH9/EX9.7/example7.sce b/1151/CH9/EX9.7/example7.sce new file mode 100755 index 000000000..898a51a3a --- /dev/null +++ b/1151/CH9/EX9.7/example7.sce @@ -0,0 +1,30 @@ +s=%s;
+ K=2.664;//K=2.664sec^-1
+g = K/(s*(s+1)*(s+4));
+ G= syslin ('c',g)
+fmin =0.01;
+fmax =100;
+bode (G,fmin , fmax )
+show_margins (G)
+xtitle (" uncompensated sys t em")
+[gm , freqGM ]= g_margin (G)
+[pm , freqPM ]= p_margin (G)
+disp(gm ," gain margin=")
+disp(( freqGM *2* %pi)," g a in margin f r e q=");
+disp(pm ," phase margin=")
+disp(( freqPM *2* %pi)," phas e margin f r e q=");
+disp("since the phase margin is greater than desired phase margin system need lag compensator ")
+gc =(s +0.1) /(0.013+s);
+ Gc= syslin ('c',gc);
+disp (Gc ," transfer function of lag compensator=");
+G1=G*Gc
+disp (G1 ," overall transfer function=");
+fmin =0.01;
+ fmax =100;
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phase margin of compensated system=")
+disp (( freqPM *2* %pi)," gain crossover frequency=")
diff --git a/1151/CH9/EX9.8/example8.sce b/1151/CH9/EX9.8/example8.sce new file mode 100755 index 000000000..24f13ef43 --- /dev/null +++ b/1151/CH9/EX9.8/example8.sce @@ -0,0 +1,30 @@ +s=%s;
+ K=23.6;//K=23.6sec^-1
+g = K/(s*(s+4)*(s+5));
+ G= syslin ('c',g)
+fmin =0.01;
+fmax =100;
+bode (G,fmin , fmax )
+show_margins (G)
+xtitle (" uncompensated sys t em")
+[gm , freqGM ]= g_margin (G)
+[pm , freqPM ]= p_margin (G)
+disp(gm ," gain margin=")
+disp(( freqGM *2* %pi)," g a in margin f r e q=");
+disp(pm ," phase margin=")
+disp(( freqPM *2* %pi)," phas e margin f r e q=");
+disp("since the phase margin is greater than desired phase margin system need lag compensator ")
+gc =(s +0.4) /(s+0.0944);
+ Gc= syslin ('c',gc);
+disp (Gc ," transfer function of lag compensator=");
+G1=G*Gc
+disp (G1 ," overall transfer function=");
+fmin =0.01;
+ fmax =100;
+bode (G1 ,fmin , fmax );
+show_margins (G1)
+xtitle (" compensated sys t em")
+[gm , freqGM ]= g_margin (G1);
+[pm , freqPM ]= p_margin (G1);
+disp (pm ," phase margin of compensated system=")
+disp (( freqPM *2* %pi)," gain crossover frequency=")
|