Professional Documents
Culture Documents
LAB FILE
Programme:
clc;
close all;
clear all;
A=[0 1 0 ; 0 0 1 ; -6 -11 -6];
B=[0 ; 5 ; -10];
C=[1 0 0];
D=[0];
[num,den]=ss2tf(A,B,C,D)
G=tf(num,den)
Output:
Experiment – 1(ii)
Aim: Transfer Function & State‐Space System: For the given transfer function
Y(s)/U(s) = [s2 + 6s +5] / [s (s + 2) (s + 3)], find the state space model in terms of
A, B, C, & D matrices / vectors.
Programme:
clc;
clear all;
close all;
num=[1 6 5]
a=conv([1 0],[1 2])
den=conv(a,[1;3])
[A,B,C,D]=tf2ss(num,den)
Output:
Experiment – 1(iii)
Aim: Transfer Function & State‐Space System: With a system described in
terms of its output y and input u through the higher order differential
equation, d2 y/dt2 + 7 dy/dt + 5 y + 6 ∫y.dt = du/dt + 3u + 2 ∫u.dt, find matrix A,
and vectors B, C, D.
Programme:
Experiment – 1(iv)
Aim: Transfer Function & State‐Space System: With the set of state equations
and output equation given below, find the Transfer Function.
X1.=x2,x2.=x3,and x3.=‐6x1‐11x2‐6x3 +6u,while y=x1
Programme:
clear all;
close all;
clc;
A=[0 1 0; 0 0 1; -6 -11 -6]
B=[0;0;6]
C=[1 0 0]
D=[0]
[num ,den]=ss2tf(A,B,C,D)
G=tf(num,den)
Output:
Experiment – 2
Aim:For a Single‐Input Single‐Output System described by the A, B, C, & D
matrices / vectors as given below, find time response of system corresponding
to unity step input [u(t) = 1] assuming zero initial condition for the states.
A=[0 1; ‐2 ‐3], B=[0;1] , C=[1 0],D=[0]
Programme:
clc;
clear all;
close all;
A=[0 1;-2 -3];
B=[0;1];
C=[1 0];
D=[0];
sys=ss(A,B,C,D)
step(sys,1)
xlabel('time')
ylabel('output')
title('step response')
grid on;
Output:
Experiment – 3(i)
Aim:Find eigenvalues and eigenvectors for the system Matrix A as given by
A=[4 3 ‐1;‐2 0 2;3 3 0]
Output:
Experiment – 3(ii)
Aim: For the third order system given below, considering 1 out 3 roots as
distinctive eigenvalue, find eigenvectors. A=[0 6 ‐5;1 0 2;3 2 4]
Output:
Experiment – 3(iii)
Aim: For the system A given by the following, find its Diagonal Canonical
Form expressed in terms of its all the distinct eigenvalues.
A=[0 1 0;0 0 1; ‐6 ‐11 ‐6]
Programme:
clear all;
close all;
clc;
A=[0 1 0; 0 0 1 ; -6 11 6]
b=eig(A)
T=[1 1 1;b(1) b(2) b(3);b(1)*b(1) b(2)*b(2)
b(3)*b(3)]
C=inv(T)*A*T
Output:
Experiment – 3(iv)
Aim: For the system A given by the following, with 1 out 3 roots as distinctive
eigenvalue, find its Jordan Canonical Form . A=[0 6 ‐5;1 0 2;3 2 4]
Programme:
clear all;
close all;
clc;
A=[0 6 -5; 1 0 2; 3 2 4]
[V,J]=jordan(A)
Output:
Experiment – 4(i)
Aim: Check for controllability and observability of system having
representation in state‐space form through A, B, C, and D matrices / vectors as
A=[0 1 0 0 0;1 0 ‐1 0 1;0 0 0 1 0;0 ‐1 0 ‐1 0],B=[0 0;1 ‐1;0 0 ;0 0;1 1],C=[1 1 1
1],D=[0 0]
Programme:
clear all;
close all;
clc;
A=[0 1 0 0 0 ; 1 0 -1 0 1 ; 0 0 0 1 0; 0 0 0 0 -1; 0 -1 0 -1
0];
B=[0 0 ;1 -1; 0 0 ; 0 0 ; 1 1];
C=[1 1 1 1 1];
P=ctrb(A,B) %controability expression
[m,n]=size(A);
k=rank(P);
if k==n
disp('sys is controllable')
else
disp('sys is uncontrollable')
end
Q=obsv(A,C) %observability expression
l=rank(Q);
if l==n
disp('sys is observable')
else
disp('sys is unobservable')
end
Output:
Experiment – 4(ii)
Aim: For the SISO system having 4 distinct eigenvalues of –1, –2, –3, –4 in the
Diagonal Canonical Form of representation and null D, with the following B and
C vectors, check for controllability and observability. B=[1 1 1 1]T ,C=[1 1 1 1]
Programme:
clear all;
close all;
clc;
A=[-1 0 0 0; 0 -2 0 0 ; 0 0 -3 0 ; 0 0 0 -4];
B=transpose([1 1 1 1]);
C=[1 1 1 1];
P=ctrb(A,B)
k=rank(P);
[m,n]=size(A);
if k==n
disp('sys is controllable')
else
disp('sys is uncontrollable')
end
Q=obsv(A,C)
l=rank(Q);
if l==n
disp('sys is observable')
else
disp('sys is unobservable')
end
Output:
Experiment – 4(iii)
Aim: With the Jordan Canonical Form representation of system check for
complete controllability and observability of system given that A=[‐1 1 0 0;0 ‐1
0 0 ;0 0 ‐3 0;0 0 0 ‐4],B=[0 ; 1; 1;1],C=[1 0 1 1],D=[0]