0% found this document useful (0 votes)
182 views6 pages

Matlab Program: 1 Response of First Order System To Unit Step Input

The document contains 4 MATLAB programs that model and analyze different systems: 1) A first order system response to a unit step input 2) A closed loop second order system step response with calculations of natural frequency, damping ratio, rise time, peak time, and settling times 3) An RL circuit response to a unit step input 4) An RC circuit response to a unit step input with a time constant calculation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views6 pages

Matlab Program: 1 Response of First Order System To Unit Step Input

The document contains 4 MATLAB programs that model and analyze different systems: 1) A first order system response to a unit step input 2) A closed loop second order system step response with calculations of natural frequency, damping ratio, rise time, peak time, and settling times 3) An RL circuit response to a unit step input 4) An RC circuit response to a unit step input with a time constant calculation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

MATLAB PROGRAM

clear
clc
%RESPONSE OF FIRST ORDER SYSTEM TO UNIT STEP INPUT
t=0:.01:7;
n=[1];
d=[1 1];
c=step(n,d,t);
plot(t,c)
xlabel('Time in sec');
ylabel('C(t)');
title('RESPONSE OF FIRST ORDER SYSTEM TO UNIT STEP INPUT');
grid

RESPONSE OF FIRST ORDER SYSTEM TO UNIT STEP INPUT

1
0.9
0.8
0.7

C(t)

0.6
0.5
0.4
0.3
0.2
0.1
0

3
4
Time in sec

MATLAB PROGRAM
clear
clc
%TIME DOMAIN SPECIFICATION OF A SECOND ORDER SYSTEM
t=0:.001:0.2;
n=[40000];
d=[1 48.5 40000];
c=step(n,d,t);
a=d(:,3);
b=d(:,2);
wn=sqrt(a);
e=b/(2*wn);
wd=wn*sqrt(1-e^2)
tr=(1/wd)*(pi/sqrt(1-e^2))
mp=exp(-e*pi/sqrt(1-e^2))
tp=pi/wd
T=1/(e*wn);
ts1=3*T %for5% T.B.
ts2=4*T %for2% T.B.
plot(t,c)
xlabel('Time in sec');
ylabel('C(t)');
title('STEP RESPONSE OF CLOSD LOOP SECOND ORDER SYSTEM');
grid

STEP RESPONSE OF CLOSD LOOP SECOND ORDER SYSTEM

1.8

OUTPUT
wd =
198.5244

1.6
1.4

C(t)

1.2

tr =

mp =
0.6813

0.8
0.6

tp =

0.4

0.0158

ts1 =
0.1237

0.2
0

0.0159

0.02

0.04

0.06

0.08
0.1
0.12
Time in sec

0.14

0.16

0.18

0.2

MATLAB PROGRAM
clear
clc
%RESPONSE OF RL CIRCUIT TO UNIT STEP INPUT
t=0:.01:7;
n=[1 0];
d=[1 1];
c=step(n,d,t);
plot(t,c)
xlabel('Time in sec');
ylabel('C(t)');
title('RESPONSE OF RL CIRCUIT TO UNIT STEP INPUT');
grid
RESPONSE OF RL TO UNIT STEP INPUT

1
0.9
0.8
0.7

C(t)

0.6
0.5
0.4
0.3
0.2
0.1
0

3
4
Time in sec

MATLAB PROGRAM
clear
clc
%RESPONSE OF RC CIRCUIT TO UNIT STEP INPUT
t=0:.01:70;
R=10;
C=1;
T=R*C;
n=[1];
d=[T 1];
c=step(n,d,t);
plot(t,c)
xlabel('Time in sec');
ylabel('C(t)');
title('RESPONSE OF RL CIRCUIT TO UNIT STEP INPUT');
grid
RESPONSE OF RL CIRCUIT TO UNIT STEP INPUT

1
0.9
0.8
0.7

C(t)

0.6
0.5
0.4
0.3
0.2
0.1
0

10

20

30
40
Time in sec

50

60

70

MATLAB PROGRAM
clear
clc
n=[10];
d=[.001 .11 1 0];
tfn=tf(n,d);
w=logspace(0,3,15);
bode(tfn,w)
[gm,pm,wcg,wcp]=margin(tfn)
if(pm>0)
disp('system is stable')
elseif(wcg==wcp)
disp('system is marginally stable')
else
disp('system is unstable')
end
grid
Bode Diagram

M agnitude (dB)

50
0
-50
-100

Phas e (deg)

-150
-90
-135
-180
-225
-270

10

10

10
Frequency (rad/sec)

system is stable

10

MATLAB PROGRAM
clear
clc
n=[1];
d=[1 4 13 0];
tfn=tf(n,d);
rlocus(tfn)
[z p k]=tf2zp(n,d);
if(real(p)<=0)
disp('system is stable')
else
disp('system is unstable')
end

Root Locus

8
6

Imaginary Axis

4
2
0
-2
-4
-6
-8
-10

-8

-6

-4

-2
Real Axis

system is stable

You might also like