The document outlines a laboratory experiment aimed at analyzing the frequency response of control systems using MATLAB software, including procedures for generating Root Locus, Bode, and Nyquist plots. It provides step-by-step instructions for writing and executing MATLAB programs to visualize transfer functions and assess system stability. Additionally, it discusses the characteristics of transfer functions, stability analysis, and methods for obtaining step and impulse responses.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
6 views12 pages
Control System Lab
The document outlines a laboratory experiment aimed at analyzing the frequency response of control systems using MATLAB software, including procedures for generating Root Locus, Bode, and Nyquist plots. It provides step-by-step instructions for writing and executing MATLAB programs to visualize transfer functions and assess system stability. Additionally, it discusses the characteristics of transfer functions, stability analysis, and methods for obtaining step and impulse responses.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
ENT OF ELECTRICAL AND CONTROL SYSTEMS AND
TRONICS ENGINEERING SIMULATION LAB
AIM.
To analyze frequency response of a system by plotting Root locus, Bode plot and Nyquist
plot using MATLAB software,
APPRATUS:
MATLAB 7 Software
Personal Computer
PROCEDURE:
1) Click on MATLAB icon.
2) From FILE menu click on NEW button and select SCRIPT to open Untitled window
3) Enter the following program in untitled window.
PROGRAM:
For Root Locus Plot:
%Root Locus Plot
clear all;
cle;
disp( ‘Transfer Function of given system is : \n’);
‘num = input (‘Enter Numerator of the Transfer Funetion:\ n’);,
den = input (‘Enter Denominator of the Transfer Function :\ n’);
G=tfnum,den);
figure(1);
rlocus(G);CONTROL SYSTEMS ANI
SIMULATION LAB
DEPARTMENT OF ELECTRICAL AND
For Bode Plot
% Bode Plot
clear all;
cle;
disp(‘Transfer Function of given system is : \n’);
num = input (‘Enter Numerator of the Transfer Function : \n’);
den = input (‘Enter Denominator of the Transfer Function : \ n’);
G =t(aumden);
figure(2);
bode (G);
‘%margin(G); It can be used to get Gain Margin, Phase Margin ete
Gm,Pm,Wpe,Wge] = margin(G);
Disp (‘Phase Cross Over frequeney is : \n’);
Woe
disp(‘Gain Cross Over frequency is : \n’);
Wee
Disp (‘Phase Margin in degrees is :\n");
Pm
Disp (‘Gain Margin in db is : \n’);
Gm
Gm=20*log(Gm)
If (WgeWpe)
disp (‘Closed loop system is unstable’)
elseDEPARTMENT OF ELECTRICAL AND CONTROL SYSTEMS AND
“TRONICS ENGINEERING SIMULATION LAB
disp(‘Closed loop system is Marginally stable’)
end
For Nyquist Plot:
% Nyquist plot
Clear all;
cle;
disp(* Transfer function of given system is \n’);
num = input (* enter numerator of Transfer function: \n “);
den = input (* enter denominator of Transfer function: \n *);
G= tf (num, den)
figure(1);
nyquist(G)
S%margin(G);
[gm, pm, wpe, wgc] = margin (G)
Disp (* gain margin in degrees is: \n’)
End
41) Save the above program by clicking on SAVE button from FILE menu (or) Ctrl+S
2) Run the program by clicking RUN button (or) FS and clear the errors (if any).
3) Observe the output on the MATLAB Command Window and plots from figure
window.
PROGRAM for ROOT LOCUS:
A given Transfer function ; Ex =
S(S+1)(8#2)
Nu o 0 tf
Den=(1 3 2 Ok
Rlocus(num,den);
PROGRAM for BODE PLOT:
A given Transfer function; Ex = 1
S(S+1)(S+2)DEPARTMENT OF ELECTRICAL AND CONTROL SYSTEMS ANI
iGINEERING SIMULATION LAB
Num=[0 0 0s
Den=[l 3 2;
bode(num,den);
PROGRAM for NYQUIST
A given Transfer function; Ex = 0s
S428? +8405
num=[0 0 0 O35};
1 05)
nyquist(num,den);
|-
GRAPHSDEPARTMENT OF ELECTRICAL AND CONTROL SYSTEMS AND
ra Kee RING SIMULATION LAB
EXPERIMENT NO:12
USING MATLAB — VERIFICATION
AIM:-To develop state space model for a transfer function using MAT LAB
Apparatus: A Personal Computer with MATLAB Soft ware installed.
1, Select M-file for performing experiment on MATLAB software
2. Write the program given below in file and save program.
3. Now close the M-file and back to main command page.
4, For executing the program to see the O/P graph, type the file name and press enter,
PROGRAM
A=[010;001;-5 -25-5]
ss2t{(A,B,C,D)
num=0 0.0000 25.0000 5.0000
den =1,0000 5.0000 25.0000 5.0000
PROGRAM 2:
Num=[0 0 0 1
Den={1 3 2 Of
{A.B,C.D]=t12ss(num,den)Laboratory 01 — ‘Transfer Functions
Objective
‘The main purpose of this lab session is to be familiar with characteristics of transfer functions using
MATLAB software
TASKI
To construct a transfer function as bellow (System variable conversions)
S47)
Posed
GS) =
In MATLAB command window, type
(Assigning the numerator and denominator coefficient vectors)
>> num » [3 21);
>> den =[1 22];
>> G=tf{num,den)
OR
>>s=tht's');
2G = (348421) (s°2+2*8+2)
‘Try to obtain the following transfer functions:
5(s+2)
GUS) = Geyer
_ 2s+3)(s+5)?
GS) = GraystenyThe time response represents how the state of a dynamic system changes in time when subjected to .
particular input, The time response of a linear dynamic system consists of the sum of the transient
response which depends on the initial conditions and the steady-state response which depends on the
system input.
Frequency response of a system
In linear time invariant (LT!) systems have the extremely important property that if the input to the
system is sinusoidal, then the steady-state output will also be sinusoidal at the same frequency but in
general with different magnitude and phase, These magnitude and phase differences as a function of
frequency comprise the frequency response of the system.
The frequency response of a system can be found from the transfer function in the following way: create
a vector of frequencies (varying between zero or "DC" to infinity) and compute the value of the plant
transfer function at those frequencies. If G..) is the open-loop transfer function of a system and w is the
frequency vector, we then plot Gia) versus @. Since Gcja)is a complex number, we can plot both its
magnitude and phase (the Bode Plot) or its position in the complex plane (the Nyquist Diagram). Both
methods display the same information in different ways.
Stability of a system
‘The transfer function representation is especially useful when analyzing system stability. If all poles of
the transfer function (values of s at which the denominator equals zero) have negative real parts, then
the system is stable. Ifany pole has a positive real part, then the system is unstable, If we view the poles
on the complex s-plane, then all poles must be in the left half plane (LHP) to ensure stability. If any
pair of poles is on the imaginary axis, then the system is marginally stable and the system will oscillate,
The poles of a LTI system model can easily be found in MATLAB using the pole command.
>es = ti's’);
>>G = I(s*2 + 2%s + 5)
>>pole(G)
ans =
-1.0000 + 2.00001
=1,0000 - 2.00001>>pzmap(G)
‘Thus this system is stable since the real parts of the poles are both negative.
Exercise 1
Check the following transfer functions stability
1.6,= a5
2.6, 5
ne s+
1
36 GOGHStep and Impulse Responses of a Transfer Function
‘To get the step response of a transfer function: use,
2
1-G" 573
>> G= tf (2), (13)
>> step (G)
To obtain impulse response: use,
>> impulse (G)
‘stepinfo(sys): this command is used to Compute
‘step response characteristics.
For the following transfer functions we will find
the settling time, rise time, overshoot and steady
‘state error:
>> stepinfo(G)
RiseTime: 0.7323
SettlingTime: 1.3040
SettlingMin: 0.6030
SettlingMax: 0.6666
Overshoot:
Undershoot:
Peak:
PeakTime:
_)oP XL |
[Link]/sii + @
alan Karunanayaks 1008/2013
Underdamped Response
G=wqi2. (1299
sep (G) Underdamped
Critcally ~ damped Response
ory
j cnitically
fig, ipl
Over — damped Response
ESE
G=wqis} (1712p
Figure, impulse (G) ‘Ovredamped
alan Karunanavake 1603/2015 °Underdamped Response
a 12
's= GiFIs49)
>> G=t({12}, (129)
>> step (G)
>> figure, impulse (G)
>> stepinfo(G)
Critically ~ damped Response
12
* W¥6s+9
6,
>> G=tf({12}, (169)
>> step (G)
>> figure, impulse (G)
>>stepinfo(G)
Over — damped Response
15
Gs GrTstiD
>> G =H (is}, (17 12)
>> step (G)
>> figure, impulse (G)
>>stepinfo(G)
a es,Undamped Response
9
os= 3e3
>> G = tf ((9}, [1.0 3])
>> step (G)
>> figure, impulse (G)
>>stepinfo(G)