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

First Order System Step Response in MATLAB

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)
132 views6 pages

First Order System Step Response in MATLAB

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

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

Common questions

Powered by AI

The Root Locus plot graphically represents how the poles of a system's transfer function move in the s-plane as a system parameter (usually gain) is varied. It provides insights into how these dynamics affect system stability, transient response, and control design by showing potential locations of closed-loop poles. It helps predict stability, oscillatory behavior, or damping alterations resulting from changes in gain or feedback .

The damping ratio \( e \) is determined by the expression \( e = b/(2*wn) \), where \( b \) is the coefficient of the first-order term in the denominator of the system's transfer function, and \( wn \) is the natural frequency. The damping ratio is crucial as it defines the poles' distance on the s-plane from the imaginary axis, influencing whether the system is underdamped, critically damped, or overdamped, affecting the speed of the transient response, overshoot, and stability .

The damping ratio influences the peak time (`tp`) by affecting the rate of oscillation and overshoot of the system. In a second-order system, the peak time is calculated using `tp=pi/wd`, where `wd` is the damped natural frequency. The damping ratio directly affects `wd` since it is calculated as `wd=wn*sqrt(1-e^2)`, meaning higher damping reduces oscillations, thereby potentially increasing `tp` .

Gain margin (`GM`) and phase margin (`PM`) are critical stability metrics in feedback systems. `GM` indicates how much the system gain can increase before reaching instability, while `PM` represents the degree of phase shift the system can tolerate before becoming unstable. A positive GM and PM suggest the system is stable, whereas negative or very low values warn of potential instability. These margins are assessed using Bode plots, where GM is determined at the phase crossover frequency, and PM is determined at the gain crossover frequency .

Settling time (`ts`) is calculated as a multiple of the time constant and damping ratio for second-order systems. It signifies the time taken for the system response to remain within a certain percentage (such as 2% or 5%) of the final value after a transient response. The expression `ts1=3*T` or `ts2=4*T` reflects the settling time for 5% or 2% criteria respectively, where `T` is the time constant related to the damping ratio and natural frequency .

MATLAB can determine the stability of electrical circuits by analyzing the location of poles using the `tf2zp` and `margin` functions. For example, after obtaining the transfer function, the Bode plot can be used to check gain and phase margins, and `rlocus` can visualize pole locations. If the real part of all poles is non-positive, the circuit is stable. If poles lie on the imaginary axis with no movement into the right half-plane, the system is marginally stable .

The MATLAB command `step(n, d, t)` is used to compute the step response of a system represented by its numerator (`n`) and denominator (`d`) polynomial coefficients over time vector `t`. For first and second-order systems, this command calculates the system's response when a unit step input is applied, allowing investigation of the system's dynamic behaviors such as rise time, peak time, and steady-state value .

The denominator coefficients in a transfer function determine the system's poles, which affect stability. The Bode plot stability analysis examines gain and phase margins derived from frequency response characteristics. Specifically, if a system's phase margin (pm) is positive, it is considered stable. The denominator's coefficients influence the phase crossover frequency and gain margin, thus affecting the system's stability shown in the Bode plot .

The `rlocus` function in MATLAB is used to plot the root locus of a system, which shows the trajectory of system poles in the complex plane as a function of a varying gain parameter. Analyzing the root locus allows engineers to determine system stability directly by observing if system poles are located within the left half of the complex plane (indicating stability) or if they cross into the right half (indicating instability).

Plotting the step response of a circuit is vital in control systems analysis as it reveals how the system reacts over time to a step input. This information corresponds to key dynamic characteristics like rise time, overshoot, settling time, and steady-state error. Analyzing these elements helps in assessing and designing control systems, ensuring desired performance criteria such as stability and response speed are met .

You might also like