Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Experiment No:

AIM: To study Step Response of Second order system


APPARATUS: Matlab
CODE:
close all;
clear all;
clc;
clf;
t=0:0.001:4;
omega_n=input('Enter the Natural Frequency:');
zeta1=input('Enter Damping Factor1:');
zeta2=input('Enter Damping Factor2:');
omega_d1=omega_n*sqrt(1-zeta1.^2);
omega_d2=omega_n*sqrt(1-zeta2.^2);
Td1=(1+0.7*zeta1)/omega_n
Td2=(1+0.7*zeta2)/omega_n;
theta1=acos(zeta1)
theta2=acos(zeta2);
Tr1=(pi-theta1)/omega_d1
Tr2=(pi-theta1)/omega_d2;
Tp1=pi./omega_d1
Tp2=pi./omega_d2;
x=input('Select Toloerance -->1:- 2% Tolerance; 2:-5% Tolerance:');
if(x==1)
Ts1=4/(omega_n.*zeta1)
Ts2=4/(omega_n.*zeta2);
else
Ts1=3/(omega_n.*zeta1)
Ts2=3/(omega_n.*zeta2);
end
Mp1=exp(-zeta1.*pi/sqrt(1-zeta1.^2))*100
Mp2=exp(-zeta2.*pi/sqrt(1-zeta2.^2))*100;
sys1=tf([omega_n^2],[1 2*zeta1*omega_n omega_n^2])
sys2=tf([omega_n^2],[1 2*zeta2*omega_n omega_n^2]);
step(sys1,sys2,t);
hold on;
text(Td1,-0.05,'|\leftarrow
text(Tr1,-0.07,'|\leftarrow
text(Tp1,-0.09,'|\leftarrow
text(Ts1,-0.11,'|\leftarrow
text(-0.1,-0.05,'\rightarrow
text(-0.1,-0.07,'\rightarrow
text(-0.1,-0.09,'\rightarrow
text(-0.1,-0.11,'\rightarrow

Td1','FontSize',12);
Tr1','FontSize',12);
Tp1','FontSize',12);
Ts1','FontSize',12);
|','FontSize',12);
|','FontSize',12);
|','FontSize',12);
|','FontSize',12);

SIMULATION:
Enter the Natural Frequency:5
Enter Damping Factor1:0.5
Enter Damping Factor2:0.25
Td1 =
0.2700
theta1 =
1.0472
Tr1 =
0.4837
Tp1 =
0.7255
Select Toloerance -->1:- 2% Tolerance; 2:-5% Tolerance:1
Ts1 =
1.6000
Mp1 =
16.3034
sys1 =
25
-------------s^2 + 5 s + 25
Continuous-time transfer function.
FIGURE

CONCLUSION: Thus we have studied how to find all the time response parameters and to plot step
response using MATLAB.

You might also like