Assignmnet 2
Assignmnet 2
Assignmnet 2
Code:
syms s
num=1;
den=sym2poly(s^2+0.4*s+1);
G=tf(num,den)
step(G)
Mathematical Model:
2)To obtain time domain specifications from a transfer function:
Code:
num=input("Enter numerator:")
den=input("Enter denominator:")
Wn=sqrt(den(3)) % Natural
frequency
z=(den(2))/(2*Wn) % damping factor
k=num/Wn^2
G=tf(num,den)
Output:
Enter numerator:[1]
num = 1
Enter denominator:[1 0.4 1]
den = 1.0000 0.4000 1.0000
Wn = 1
z = 0.2000
k=1
G=
1
---------------
s^2 + 0.4 s + 1
Continuous-time transfer function.
Model Properties
Td = 1.1400
Tp = 3.2064
th = 1.3694
Tr = 1.8087
per_OS = 52.6621
Ts_2 = 20
Ts_5 = 15
Output:
A=
-0.4000 -1.0000
1.0000 0
B= 1
0
C= 0 1
D= 0
4)Obtain Controllability and Observability for 3 × 3 using MATLAB.
Obtain Step, Ramp and Parabolic response for a given system using
MATLAB.
Code:
A=input("Enter Matrix A:")
B=input("Enter Matrix B:")
C=input("Enter Matrix C:")
Qc=ctrb(A,B)
Qcd=det(Qc)
if Qcd==0
disp("System is not controllable.")
else
disp("System is controllable.")
end
Qo=obsv(A,C)
Qod=det(Qo)
if Qod==0
disp("System is not observable.")
else
disp("System is observable.")
end
Output:
Enter Matrix A:[-0.4 -1 ; 1 0]
A = -0.4000 -1.0000
1.0000 0
Enter Matrix B:[1; 0]
B= 1
0
Enter Matrix C:[0 1]
C= 0 1
Qc = 1.0000 -0.4000
0 1.0000
Qcd = 1
System is controllable.
Qo = 0 1
1 0
Qod = -1
System is observable.
Mathematical Model: