Tutorial 10 Done by - Vaishnav Shankar Roll No - 37 REG NO - 150906260
Tutorial 10 Done by - Vaishnav Shankar Roll No - 37 REG NO - 150906260
Tutorial 10 Done by - Vaishnav Shankar Roll No - 37 REG NO - 150906260
DONE BY -
VAISHNAV SHANKAR
ROLL NO – 37
REG NO – 150906260
1]
CODE -
A=[-2 -1 -3; 0 -2 1; -7 -8 -9]
B=[2;1;2];
C=[ 4 6 8];
Q=obsv(A,C)
d=det(Q)
r=rank(Q)
if(size(Q)==r)
disp('Observable s/m')
else
disp('not observable')
end
t=ctrb(A,B)
D=det(t)
R=rank(t)
if(size(t)==R)
disp('CONTROLABLE s/m')
else
disp('not CONTROLLABLE')
end
OUTPUT-
A=
-2 -1 -3
0 -2 1
-7 -8 -9
Q=
4 6 8
-64 -80 -78
674 848 814
d=
-1.5760e+03
r= 3
Observable s/m
t=
2 -11 142
1 0 -40
2 -40 437
D=
-3.1930e+03
R=
3
CONTROLABLE s/m
2]
CODE -
num=20*[1 5]
den=poly([0 -1 -4])
sys=tf(num,den)
[a b c d] = tf2ss(num,den)
ap=fliplr(flipud(a))
bp=flipud(b);
cp=fliplr(c)
dp=d
pos=9.5;
ts=0.74;
z=(-log(pos/100))/(sqrt(pi^2+log(pos/100)^2))
wn =4/(z*ts)
[num,den]=ord2(wn,z)
r=roots(den)
p1=[r(1) r(2) -5]
k=acker(ap,bp,p1)
anew=ap-bp*k;
tss=ss(anew,bp,cp,dp)
figure,step(feedback(sys,1))
figure,step(tss)
OUTPUT-
num =
20 100
den =
1 5 4 0
sys =
20 s + 100
-----------------
s^3 + 5 s^2 + 4 s
b=
1
0
0
c=
0 20 100
d= 0
ap =
0 1 0
0 0 1
0 -4 -5
cp =
100 20 0
dp = 0
z=
0.5996
wn =
9.0147
num =
1
den =
1.0000 10.8108 81.2645
r=
-5.4054 + 7.2143i -5.4054 - 7.2143i
p1 =
-5.4054 + 7.2143i -5.4054 - 7.2143i -5.0000 + 0.0000i
k=
406.3226 131.3186 10.8108
tss =
A=
x1 x2 x3
x1 0 1 0
x2 0 0 1
x3 -406.3 -135.3 -15.81
B=
u1
x1 0
x2 0
x3 1
C=
x1 x2 x3
y1 100 20 0
D=
u1
y1 0
CODE -
clc;clear;
num = 407*[1 .916];
den= poly([-1.27 -2.69]);
sys= tf(num,den);
[a b c d]=tf2ss(num,den);
ap= fliplr(flipud(a));
bp= flipud(b);
cp= fliplr(c);
dp=d;
OUTPUT-
l=
-38.6236
35.7135
4]
CODE -
A=[0 -83.33; 500 -10];
B=[166.67;0];
C=[0 1];
D=0;
[n d]=ss2tf(A,B,C,D)
%state feedback controller
AP=fliplr(flipud(A));
BP=flipud(B)
CP=fliplr(C);
DP=D;
pos=20;
Ts=0.5;
z=(-log(pos/100))/(sqrt(pi^2+log(pos/100)^2))
wn=4/(z*Ts);
[num,den]=ord2(wn,z);
r=roots(den);
P1=[r(1) r(2)];
K=acker(AP,BP,P1)
Anew=AP-BP*K;
Tss=ss(Anew,BP,CP,DP)
[num den]=ss2tf(Anew,BP,CP,DP);
figure(1)
step(num,den)
title('With Controller')
figure(2)
step(n,d)
title('Given System')
%observer
L=acker(AP',CP',P1)'
Z=[0 0;0 0];
BPP=[BP;0;0];
CPP=[CP 0 0];
Anew1=[AP-BP*K BP*K;Z AP-L*CP]
Oss=ss(Anew1,BPP,CPP,DP)
[num1 den1]=ss2tf(Anew1,BPP,CPP,DP);
figure(3)
step(num1,den1)
title('With Controller and Observed’)
OUTPUT-
n= 0 0 83335
d=
1.0e+04 *
0.0001 0.0010 4.1665
BP =
0
166.6700
z=
0.4559
K=
-0.4970 0.0360
Tss =
A=
x1 x2
x1 -10 500
x2 -0.4957 -6
B=
u1
x1 0
x2 166.7
C=
x1 x2
y1 1 0
D=
u1
y1 0
Continuous-time state-space model.
L=
6.0000
-82.7143
Anew1 =
-10.0000 500.0000 0 0
-0.4957 -6.0000 -82.8343 6.0000
0 0 -16.0000 500.0000
0 0 -0.6157 0
Oss =
A=
x1 x2 x3 x4
x1 -10 500 0 0
x2 -0.4957 -6 -82.83 6
x3 0 0 -16 500
x4 0 0 -0.6157 0
B=
u1
x1 0
x2 166.7
x3 0
x4 0
C=
x1 x2 x3 x4
y1 1 0 0 0
D=
u1
y1 0