diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /29/CH9 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '29/CH9')
23 files changed, 391 insertions, 0 deletions
diff --git a/29/CH9/EX9.10.10/exa9_10_10.sce b/29/CH9/EX9.10.10/exa9_10_10.sce new file mode 100755 index 000000000..9707dd3c0 --- /dev/null +++ b/29/CH9/EX9.10.10/exa9_10_10.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.10
+//page 393
+s=%s;
+g=(s^2+6*s+8)/((s+3)*(s^2+2*s+5));
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.10.11/exa9_10_11.sce b/29/CH9/EX9.10.11/exa9_10_11.sce new file mode 100755 index 000000000..c99f11012 --- /dev/null +++ b/29/CH9/EX9.10.11/exa9_10_11.sce @@ -0,0 +1,27 @@ +//caption:obtain_time_response
+//example 9.10.11
+//page 394
+s=%s;
+syms t
+A=[0 1;-2 0]
+B=[1 -1]
+x0=[1 1]'
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+//for calculating state transistion matrix
+ip=[0 0;0 0]
+i=1;j=1;
+for i=1:2
+ for j=1:2
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ i=i+1;
+end
+disp(ip,"state transistion matrix,ip(t)=");
+x=ip*x0
+y=x(1,1)-x(2,1)
+y=simple(y) //output
+disp(y,"time response of the system,y(t)=");
diff --git a/29/CH9/EX9.10.12.i/exa9_10_12_i.sce b/29/CH9/EX9.10.12.i/exa9_10_12_i.sce new file mode 100755 index 000000000..fc9dd8742 --- /dev/null +++ b/29/CH9/EX9.10.12.i/exa9_10_12_i.sce @@ -0,0 +1,25 @@ +//caption:obtain_zero_input_response
+//example 9.10.12_(i)
+//page 395
+s=%s;
+syms t
+A=[0 1;-2 -1]
+B=[0 1]'
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+//for calculating state transistion matrix
+ip=[0 0;0 0]
+i=1;j=1;
+for i=1:2
+ for j=1:2
+ ip(i,j)=ilaplace(r(i,j),s,t);
+ j=j+1;
+ end
+ i=i+1;
+end
+disp(ip,"state transistion matrix,ip(t)=");
+x=ip*x0
+disp(x,"zero input response of the system,x(t)=");
diff --git a/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce b/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce new file mode 100755 index 000000000..6e2ab4348 --- /dev/null +++ b/29/CH9/EX9.10.12.ii/exa9_10_12_ii.sce @@ -0,0 +1,18 @@ +//caption:obtain_zero_state_response
+//example 9.10.12_(ii)
+//page 395
+s=%s;
+syms t
+A=[0 1;-2 -1]
+B=[0 1]'
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+q=det(p)//determinant of sI-A
+r=inv(p)//inverse of sI-A
+m=r*B*(1/s);
+//for calculating zero state response
+x=[0;0]
+x(1,1)=ilaplace(m(1,1),s,t);
+x(2,1)=ilaplace(m(2,1),s,t);
+disp(x,"zero input response of the system,x(t)=");
diff --git a/29/CH9/EX9.10.13/exa9_10_13.sce b/29/CH9/EX9.10.13/exa9_10_13.sce new file mode 100755 index 000000000..a44ac45cc --- /dev/null +++ b/29/CH9/EX9.10.13/exa9_10_13.sce @@ -0,0 +1,13 @@ +//caption:obtain_time_response
+//example 9.10.13
+//page 397
+syms t;
+A=[0 1;-2 0]
+x0=[1 1]'
+[r c]=size(A);//size of matrix A
+//since exp(At)=I+A*t+(A*t)^2/2+(A*t)^3/3+...
+I=eye(r,c)
+p=I+A*t+(A*t)^2/2+(A*t)^3/3
+x=p*x0;
+disp(x(1,1),"time response of the system,x1(t)=");
+disp(x(2,1),"time response of the system,x2(t)=");
\ No newline at end of file diff --git a/29/CH9/EX9.10.14/exa9_10_14.sce b/29/CH9/EX9.10.14/exa9_10_14.sce new file mode 100755 index 000000000..55b6a520b --- /dev/null +++ b/29/CH9/EX9.10.14/exa9_10_14.sce @@ -0,0 +1,39 @@ +//caption:obtain_time_response_using_diagonalization_process
+//example 9.10.14
+//page 398
+syms m11 m22 m21 m12 t;
+s=%s;
+poly(0,"l");
+A=[1 4;-2 -5]
+B=[0;1]
+C=[1;0]'
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+I=eye(r,c);
+p=l*I-A;//l*I-A where I is identity matrix
+q=det(p)//determinant of lI-A
+
+//roots of q are -1 and -3
+l1=-1;
+l2=-3;
+//for determining modal matrix
+x1=[m11;m21]
+q1=(l1*I-A)*x1
+//on solving we find m11=1, m21=-0.5
+m11=1;m21=-0.5
+x2=[m12;m22]
+q2=(l2*I-A)*x1
+//on solving we find m12=1, m22=-1
+m12=1;m22=-1
+M=[m11 m12;m21 m22]
+M1=inv(M);
+k1=M1*A*M;
+z0=M1*x0;
+k2=M1*B
+Z=inv(s*I-k1)*z0+(inv(s*I-k1)*k2)*(1/s);
+X=M*Z
+x=[0;0]
+x(1,1)=ilaplace(X(1,1),s,t);
+x(2,1)=ilaplace(X(2,1),s,t);
+y=C*x
+disp(y,"output_equation_is,y(t)=")
\ No newline at end of file diff --git a/29/CH9/EX9.10.15/exa9_10_15.sce b/29/CH9/EX9.10.15/exa9_10_15.sce new file mode 100755 index 000000000..34616873e --- /dev/null +++ b/29/CH9/EX9.10.15/exa9_10_15.sce @@ -0,0 +1,32 @@ +//caption:obtain_time_response_using_diagonalization_process
+//example 9.10.15
+//page 403
+syms t;
+s=%s;
+poly(0,"l");
+A=[0 1;-6 -5]
+B=[0;1]
+C=[6 1]
+x0=[1 0]'
+[r c]=size(A);//size of matrix A
+I=eye(r,c);
+p=l*I-A;//l*I-A where I is identity matrix
+q=det(p)//determinant of lI-A
+//roots of q are -1 and -3
+l1=-2;
+l2=-3;
+//for determining vandermonde's matrix
+P=[1 1;l1 l2];
+P1=inv(P);
+k1=P1*A*P;
+z0=P1*x0;
+k2=P1*B
+Z=inv(s*I-k1)*z0+(inv(s*I-k1)*k2)*(1/s);
+X=P*Z
+X(2,1)=-5/(s^2+5*s+6)
+x=[0;0]
+x(1,1)=ilaplace(X(1,1),s,t);
+x(2,1)=ilaplace(X(2,1),s,t);
+y=C*x
+y=simple(y)
+disp(y,"output_equation_is,y(t)=")
\ No newline at end of file diff --git a/29/CH9/EX9.10.16/exa9_10_16.sce b/29/CH9/EX9.10.16/exa9_10_16.sce new file mode 100755 index 000000000..f8dbe0564 --- /dev/null +++ b/29/CH9/EX9.10.16/exa9_10_16.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.16
+//page 406
+clc;
+s=%s
+A=[1 -2;4 -5]
+B=[2;1]
+C=[1 1]
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.17/exa9_10_17.sce b/29/CH9/EX9.10.17/exa9_10_17.sce new file mode 100755 index 000000000..70fc9f052 --- /dev/null +++ b/29/CH9/EX9.10.17/exa9_10_17.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.17
+//page 407
+s=%s
+A=[-3 1;0 -1]
+B=[1;1]
+C=[1 1]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.18/exa9_10_18.sce b/29/CH9/EX9.10.18/exa9_10_18.sce new file mode 100755 index 000000000..31700cf3c --- /dev/null +++ b/29/CH9/EX9.10.18/exa9_10_18.sce @@ -0,0 +1,13 @@ +//caption:determine_transfer_matrix
+//example 9.10.17
+//page 407
+s=%s
+A=[0 3;-2 -5]
+B=[1 1;1 1]
+C=[2 1;1 0]
+D=0;
+[r c]=size(A);//size of matrix A
+p=s*eye(r,c)-A;//s*I-A where I is identity matrix
+r=inv(p)//inverse of sI-A
+G=C*r*B//transfer matrix
+disp(G,"transfer matrix=")
diff --git a/29/CH9/EX9.10.20/exa9_10_20.sce b/29/CH9/EX9.10.20/exa9_10_20.sce new file mode 100755 index 000000000..2f15184c5 --- /dev/null +++ b/29/CH9/EX9.10.20/exa9_10_20.sce @@ -0,0 +1,14 @@ +//caption:check_for_contrallability_of_system
+//example 9.10.20
+//page 410
+A=[0 1 0;0 0 1;0 -2 -3]
+B=[0 1;0 0;1 1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+S=[P(1) P(4) P(7);P(2) P(5) P(8);P(3) P(6) P(9)];//collecting columns from P to form a square matrix (3*3)
+d=det(S);
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.10.21/exa9_10_21.sce b/29/CH9/EX9.10.21/exa9_10_21.sce new file mode 100755 index 000000000..beae1cf20 --- /dev/null +++ b/29/CH9/EX9.10.21/exa9_10_21.sce @@ -0,0 +1,22 @@ +//caption:check_for_contrallability_and_observability_of_system
+//example 9.10.21
+//page 411
+A=[0 1 0;0 0 1;-6 -11 -6]
+B=[1 0 1]'
+C=[10 5 1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=det(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
+P1=obsv_mat(A,C);
+disp(P1,"Observability Matrix=");
+d1=det(P1)
+if d1==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.10.22/exa9_10_22.sce b/29/CH9/EX9.10.22/exa9_10_22.sce new file mode 100755 index 000000000..f3383b3ae --- /dev/null +++ b/29/CH9/EX9.10.22/exa9_10_22.sce @@ -0,0 +1,30 @@ +//caption:check_for_contrallability_and_observability_of_system
+//example 9.10.21
+//page 411
+s=%s;
+g=(10*(s+3))/((s+4)*(s+2)^2);
+CL=syslin('c',g);
+disp(CL,"Y(s)/U(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+A=SS(2)
+B=SS(3)
+C=SS(4)
+P=cont_mat(A,B);
+P=round(P)
+disp(P,"Controllability Matrix=");
+d=det(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
+P1=obsv_mat(A,C);
+P1=round(P1);
+disp(P1,"Observability Matrix=");
+d1=det(P1)
+if d1==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end
\ No newline at end of file diff --git a/29/CH9/EX9.10.4.a/exa9_10_4_a.sce b/29/CH9/EX9.10.4.a/exa9_10_4_a.sce new file mode 100755 index 000000000..850208a93 --- /dev/null +++ b/29/CH9/EX9.10.4.a/exa9_10_4_a.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.4_a
+//page 387
+s=%s;
+g=1/((s+1)*(s+3));
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.10.4.b/exa9_10_4_b.sce b/29/CH9/EX9.10.4.b/exa9_10_4_b.sce new file mode 100755 index 000000000..c8d910df6 --- /dev/null +++ b/29/CH9/EX9.10.4.b/exa9_10_4_b.sce @@ -0,0 +1,12 @@ +//caption:obtain_state_matrix
+//example 9.10.4_b
+//page 387
+clc;
+s=%s;
+g=(2*s+1)/(s^2+2);
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
diff --git a/29/CH9/EX9.10.5/exa9_10_5.sce b/29/CH9/EX9.10.5/exa9_10_5.sce new file mode 100755 index 000000000..94c55aa93 --- /dev/null +++ b/29/CH9/EX9.10.5/exa9_10_5.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.5
+//page 388
+s=%s;
+g=(s+3)/(s^2+3*s+4);
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.10.6/exa9_10_6.sce b/29/CH9/EX9.10.6/exa9_10_6.sce new file mode 100755 index 000000000..901889d19 --- /dev/null +++ b/29/CH9/EX9.10.6/exa9_10_6.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.6
+//page 389
+s=%s;
+g=(s^2+3*s+2)/(s^3+9*s^2+26*s+24);
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.10.7/exa9_10_7.sce b/29/CH9/EX9.10.7/exa9_10_7.sce new file mode 100755 index 000000000..5c78cd19e --- /dev/null +++ b/29/CH9/EX9.10.7/exa9_10_7.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.7
+//page 390
+s=%s;
+g=(s+3)/((s+1)*(s+2));
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.10.9/exa9_10_9.sce b/29/CH9/EX9.10.9/exa9_10_9.sce new file mode 100755 index 000000000..964be6667 --- /dev/null +++ b/29/CH9/EX9.10.9/exa9_10_9.sce @@ -0,0 +1,11 @@ +//caption:obtain_state_matrix
+//example 9.10.9
+//page 392
+s=%s;
+g=(10*(s+3))/((s+4)*(s+2)^2);
+CL=syslin('c',g);
+disp(CL,"C(s)/R(s)=");
+SS=tf2ss(CL)
+[Ac,Bc,U,ind]=canon(SS(2),SS(3))
+disp(SS,"state space matrix=")
+disp(Ac,"Ac",Bc,"Bc",U,"U",ind,"ind")
\ No newline at end of file diff --git a/29/CH9/EX9.8.1/exa9_8_1.sce b/29/CH9/EX9.8.1/exa9_8_1.sce new file mode 100755 index 000000000..cddb6f979 --- /dev/null +++ b/29/CH9/EX9.8.1/exa9_8_1.sce @@ -0,0 +1,13 @@ +//caption:check_for_contrallability_of_system
+//example 9.8.1
+//page 381
+A=[1 1;0 -1]
+B=[1;0]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.8.2/exa9_8_2.sce b/29/CH9/EX9.8.2/exa9_8_2.sce new file mode 100755 index 000000000..2d8176767 --- /dev/null +++ b/29/CH9/EX9.8.2/exa9_8_2.sce @@ -0,0 +1,13 @@ +//caption:check_for_contrallability_of_system
+//example 9.8.2
+//page 381
+A=[-2 0;0 -1]
+B=[1;1]
+P=cont_mat(A,B);
+disp(P,"Controllability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is uncontrollable");
+else
+ printf("system is controllable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.9.1.a/exa9_9_1_a.sce b/29/CH9/EX9.9.1.a/exa9_9_1_a.sce new file mode 100755 index 000000000..ae0f6489b --- /dev/null +++ b/29/CH9/EX9.9.1.a/exa9_9_1_a.sce @@ -0,0 +1,14 @@ +//caption:check_for_observability_of_system
+//example 9.9.1_a
+//page 383
+A=[0 1;-2 -3]
+B=[0;1]
+C=[1 1]
+P=obsv_mat(A,C);
+disp(P,"Observability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file diff --git a/29/CH9/EX9.9.1.b/exa9_9_1_b.sce b/29/CH9/EX9.9.1.b/exa9_9_1_b.sce new file mode 100755 index 000000000..e4eeec6ae --- /dev/null +++ b/29/CH9/EX9.9.1.b/exa9_9_1_b.sce @@ -0,0 +1,14 @@ +//caption:check_for_observability_of_system
+//example 9.9.1_b
+//page 383
+A=[-2 1;0 1]
+B=[1;1]
+C=[1 1]
+P=obsv_mat(A,C);
+disp(P,"Observability Matrix=");
+d=determ(P)
+if d==0
+ printf("matrix is singular, so system is unobservable");
+else
+ printf("system is observable");
+end;
\ No newline at end of file |