Assignmnet 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

1) To obtain step response from a transfer function:

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)

Td=(1+0.7*z)/Wn % Delay time


Tp=pi/(Wn*sqrt(1-z^2)) % Peak time
th=atan(sqrt(1-z^2)/z) % Gives in radian
Tr=(pi-th)/(Wn*sqrt(1-z^2)) % Rising time
per_OS=exp((-pi*z)/(sqrt(1-z^2)))*100 % Percent
overshooting
Ts_2=4/(z*Wn) % 2% settling time
Ts_5=3/(z*Wn) % 5% settling time

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

3)To represent system in state space using transfer function:


Code:
syms s
num=1;
den=sym2poly(s^2+0.4*s+1);
[A,B,C,D]=tf2ss(num,den)

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:

You might also like