0% found this document useful (0 votes)
295 views5 pages

First Order System Step Response in MATLAB

The document describes several experiments related to analyzing system dynamics and stability using MATLAB. Experiment 1 generates a step response for a first order system. Experiment 2 does the same for a second order system. Experiment 3 examines reducing steady state error using feedback. Experiment 4 analyzes stability based on pole position. Experiment 5 covers root locus analysis and feedback controller design. Experiment 6 obtains Bode plots to assess stability. The document provides MATLAB code examples for each experiment.

Uploaded by

Darshan Deepu
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)
295 views5 pages

First Order System Step Response in MATLAB

The document describes several experiments related to analyzing system dynamics and stability using MATLAB. Experiment 1 generates a step response for a first order system. Experiment 2 does the same for a second order system. Experiment 3 examines reducing steady state error using feedback. Experiment 4 analyzes stability based on pole position. Experiment 5 covers root locus analysis and feedback controller design. Experiment 6 obtains Bode plots to assess stability. The document provides MATLAB code examples for each experiment.

Uploaded by

Darshan Deepu
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
  • Experiment 3: Steady-State Error
  • Experiment 2: Time Response of Second Order System
  • Experiment No.1: Time Response of First Order System
  • Experiment 4: Stability Analysis Based on Pole Position
  • Experiment 5: Root Locus Analysis
  • Experiment 6: Stability Analysis of System using Bode Plot

EXPERIMENT NO.

1
Time response of First order system
[Link] PROGRAM

% Write a MATLAB code to plot Response


% input unit step input
% R=1 ohm, L=1 H
%The transfer function is 1/(s+1)
num=[1]
den=[1 1]
step(num ,den)
grid title(’The unit step response of transfer function 1/(s+1’)

EXPERIMENT-2
Time response of Second order system

MATLAB code:
% Write a MATLAB code to plot Response
% input unit step input
% R=1 ohm, L=1 H,C=1F
%The transfer function is
num=[1];
den=[1 1 1];
step(num ,den)
grid title(’The unit step response of transfer function S/(s+1)

Experiment 3
Steady-State Error
Aim:
To reduce steady state error of a system.
Key MATLAB commands used are: lsim,feedback

s = tf('s');
G = ((s+3)*(s+5))/(s*(s+7)*(s+8));
T = feedback(G,1);
t = 0:0.1:25;
u = t;
[y,t,x] = lsim(T,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')

Let's see the ramp input response for K = 37.33 by entering the following code in the
MATLAB command window.
----------------------------------------------------------------------------------------------------------------
K = 37.33 ;
s = tf('s');
G = (K*(s+3)*(s+5))/(s*(s+7)*(s+8));
sysCL = feedback(G,1);
t = 0:0.1:50;
u = t;
[y,t,x] = lsim(sysCL,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')

From our tables, we know that a system of type 2 gives us zero steady-state error for a ramp
input. Therefore, we can get zero steady-state error by simply adding an integrator (a pole at
the origin). Let's view the ramp input response for a step input if we add an integrator and
employ a gain K = 1.

s = tf('s');
P = ((s+3)*(s+5))/(s*(s+7)*(s+8));
C = 1/s;
sysCL = feedback(C*P,1);
t = 0:0.1:250;
u = t;
[y,t,x] = lsim(sysCL,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
----------------------------------------------------------------------------------------------------------------
EXPERIMENT 4
Stability Analysis Based on Pole position

MATLAB command to calculate pole value.


----------------------------------------------------------------------------------------------------------------
s = tf('s');
G = 1/(s^2+2*s+5)
pole(G)

MATLAB code to plot pole-zero map for under damped system( zeta<1)
----------------------------------------------------------------------------------------------------------------
k_dc = 1;
w_n = 10;
zeta = 0.2;
s = tf('s');
G1 = k_dc*w_n^2/(s^2 + 2*zeta*w_n*s + w_n^2);
pzmap(G1)
axis([-3 1 -15 15])

MATLAB code to plot pole-zero map for over damped system( zeta>1)
----------------------------------------------------------------------------------------------------------------
zeta = 1.2;
G2 = k_dc*w_n^2/(s^2 + 2*zeta*w_n*s + w_n^2);
pzmap(G2)
axis([-20 1 -1 1])

MATLAB code to plot pole-zero map for critically damped system( zeta=1)
----------------------------------------------------------------------------------------------------------------
zeta = 1;
G3 = k_dc*w_n^2/(s^2 + 2*zeta*w_n*s + w_n^2);
pzmap(G3)
axis([-11 1 -1 1])

MATLAB code to plot step response of G3.


----------------------------------------------------------------------------------------------------------------
step(G3)
axis([0 1.5 0 1.5])

MATLAB code to plot pole-zero map for undamped system( zeta=0)


-------------------------------------------------------------------------------------------------------------
zeta = 0;
G4 = k_dc*w_n^2/(s^2 + 2*zeta*w_n*s + w_n^2);
pzmap(G4)
axis([-1 1 -15 15])
EXPERIMENT 5
Root Locus Analysis
Aim:
i. Create root locus for a given transfer function using MATLAB
ii. To demonstrate how to design feedback controller using root locus that satisfy certain
performance criteria.
Key MATLAB commands used in this tutorial are: feedback, rlocus, step,

How do we design a feedback controller for the system by using the root locus method? Say
our design criteria are 5% overshoot and 1 second rise time. Make a MATLAB file
called rl.m. Enter the transfer function, and the command to plot the root locus:
MATLAB program to plot root locus of transfer function H(s)=(s+5)/s(s+5)(s+15)(s+20)
tf('s');
sys = (s + 7)/(s*(s + 5)*(s + 15)*(s + 20));
rlocus(sys)
axis([-22 3 -15 15])

Continuation of above MATLAB prog. The following instructions plot lines of constant
damping ratio and natural frequency on pole zero map or root locus.
----------------------------------------------------------------------------------------------------------------
Zeta = 0.7;
Wn = 1.8;
sgrid(Zeta,Wn)

MATLAB command to find TF of closed loop system.


----------------------------------------------------------------------------------------------------------------
K = 350;
sys_cl = feedback(K*sys,1)

To Check out the step response of your closed-loop system:


----------------------------------------------------------------------------------------------------------------
step(sys_cl)

EXPERIMENT-6
Stability Analysis of system using Bode Plot

Aim:
To obtain bode plot for a given transfer function of the system using MATLAB and to
find stability of system.
Key MATLAB commands used in this tutorial are: bode(num,den).
MATLAB program to simulate bode plot for –
----------------------------------------------------------------------------------------------
num=[0 0 0 4.2];
den=[1 4 5 0];
bode(num,den);

Common questions

Powered by AI

MATLAB serves as an essential tool in simulating and analyzing control systems through its powerful functions such as root locus and pole-zero maps. These tools allow engineers to visualize and manipulate the dynamic behavior of systems, assessing stability and transient performance. Root locus provides insights into the effects of varying gains on system poles, while pole-zero maps display how the damping factor influences system response and stability. This simulation capability is crucial for designing robust controllers and verifying theoretical predictions .

Standard MATLAB experiments like time response analysis and steady-state error computation provide practical insights into system dynamics and performance characteristics. Time response analysis elucidates transient behaviors, such as oscillations and settling time, while steady-state error analysis quantifies a system's precision in tracking different input types. These experiments enable verification of theoretical models and significantly enhance understanding of system behavior under realistic conditions .

Altering the gain (K) in root locus analysis changes the position of the closed-loop poles along the root locus path. As K increases, poles generally move towards the zeros of the transfer function. This movement can lead to varying degrees of system stability. High gain values might push poles into the right-half of the s-plane causing instability, whereas a controlled gain might keep them in the left-half, maintaining or even improving stability .

In control theory, a system's type is defined by the number of integrators (poles at the origin) in the open-loop transfer function. The type affects how the system handles steady-state errors for different input signals. A type 0 system has a finite steady-state error for a step input and infinite error for ramp and parabolic inputs. A type 1 system has zero error for a step input, finite error for a ramp input, and infinite error for a parabolic input. A type 2 system achieves zero steady-state error for both step and ramp inputs .

Stability analysis using poles involves assessing the location of poles in the s-plane for a given transfer function. A system is stable if all poles are in the left-half s-plane. MATLAB visually represents this through pole-zero maps in different damping conditions: poles lying on the right signify instability, while those on the left indicate stability. Root locus and Bode plots further aid by demonstrating how pole positions change with varying system parameters, providing key insights into potential stability with parameter variations .

When designing a feedback controller using the root locus method to meet specific performance criteria like 5% overshoot and a 1-second rise time, you begin by determining the desired closed-loop pole locations that satisfy these criteria. Tools like constant damping ratio and natural frequency lines help to visualize these parameters on the root locus plot. Adjustments in the gain and potential addition of compensators (e.g., lead or lag networks) are made to shift the root locus to pass through these points, ensuring the system meets the transient performance requirements .

To plot a Bode plot for a given transfer function in MATLAB, you use the bode function with defined numerator and denominator vectors of the transfer function. The resulting plots provide frequency response characteristics like gain margin and phase margin, crucial for determining stability margins. These margins inform whether a system will remain stable under varying operational conditions or external disturbances .

Adding an integrator (a pole at the origin) to a second-order system changes its type, allowing it to achieve zero steady-state error for a ramp input. This is because a type 2 system, which includes the integrator, inherently cancels out the error in steady-state for ramp inputs .

Different damping factors (zeta values) significantly alter the pole-zero map and thus influence a system's stability and transient behavior. An overdamped system (zeta > 1) shows poles that are real and distinct, leading to slower response but no overshoot. A critically damped system (zeta = 1) has repeated real poles, offering the fastest response without overshoot. An underdamped system (0 < zeta < 1) displays complex conjugate poles, resulting in oscillations with overshoot. An undamped system (zeta = 0) has purely imaginary poles, exhibiting sustained oscillations with constant magnitude, potentially leading to instability if not controlled .

The feedback MATLAB command forms a closed-loop transfer function by taking an open-loop transfer function and a feedback path, typically with a unity gain, and closing the loop. This command is significant in control system design as it facilitates analysis of the closed-loop dynamics, allowing for adjustments in system parameters to meet desired performance specifications such as stability and response time. This closed-loop formation is essential for practical control applications .

EXPERIMENT NO.1
Time response of First order system
1.MATLAB PROGRAM
% Write a MATLAB code to plot Response
% input unit step
[y,t,x] = lsim(T,u,t);
plot(t,y,'y',t,u,'m')
xlabel('Time (sec)')
ylabel('Amplitude')
title('Input-purple, Output-yellow')
Le
EXPERIMENT 4
Stability Analysis Based on Pole position
MATLAB command to calculate pole value.
------------------------------
EXPERIMENT 5
Root Locus Analysis
Aim:
i. Create root locus for a given transfer function using MATLAB
ii. To demonstrate how
MATLAB program to simulate bode plot for –
----------------------------------------------------------------------------------

You might also like