CS - Manual-Nazia
CS - Manual-Nazia
CONTROL SYSTEMS
Lab Manual
▪ To continuously keep abreast with current trends and technology that support the
students to excel in the area of Electronics and Communication Engineering.
▪ Provide ethical and value based education by promoting activities addressing the
social and industrial needs.
⮚ Graduates will be able to analyze real life problems, design appropriate systems to
provide solutions that are technically sound, economically feasible and socially
acceptable.
● Graduates will be able to Analyze and design analog & digital circuits using
fundamentals of electronics engineering and build systems which will be useful for
the society.
● Graduates will be able to implement functional blocks of hardware and software for
signal processing and communication applications along with automation systems
to process different signals.
BEC403 Control Systems Lab
VTU Syllabus
TABLE OF CONTENTS
EXPERIMENT PAGE
EXPERIMENT NAME
NO. NO.
Demonstration Experiments
Aim: To familiarize with MATLAB software, general functions and signal processing
toolbox functions.
The name MATLAB stands for MATrix LABoratory produced by Math works
Inc., USA. It is a matrix-based powerful software package for scientific and
engineering computation and visualization. Complex numerical problems can be
solved in a fraction of the time that required with other high level languages. It
provides an interactive environment with hundreds of built -in –functions for
technical computation, graphics and animation. In addition to built-in-functions,
user can create his own functions.
MATLAB offers several optional toolboxes, such as signal processing,
control systems, neural networks etc. It is command driven software and has
online help facility.
MATLAB has three basic windows normally; command window, graphics
window and edit window.
Command window is characterized by the prompt ‘>>’.
All commands and the ready to run program filename can be typed here. Graphic
window gives the display of the figures as the result of the program. Edit window
is to create program files with an extension.m
Command Function
help List topics on which help is available
help command name Provides help on the topic selected
demo Runs the demo program
who Lists variables currently in the workspace
whos Lists variables currently in the workspace with their size
clear Clears the workspace, all the variables are removed
clear x,y,z Clears only variables x,y,z
quit Quits MATLAB
EXPERIMENT NO. 1
Aim: Obtain the Transfer function using Block Diagram Reduction method and
hence obtain its step response.
% MATLAB Code
n1=[50 70];
d1=[1 7];
gc=tf(n1,d1);
n2=[1];
d2=[1 5 4 0];
gp=tf(n2,d2);
g=series(gc,gp);
t=feedback(g,1);
step(t);
disp(t)
Exercise Problem:
Write the MATLAB Code to find the overall transfer function for the Block diagram
shown below
g7=parallel(g3,-g5);
g8=series(g1,g6);
g9=series(g8,g7);
tf=feedback(g9,1);
disp(tf)
EXPERIMENT NO.2
Write the MATLAB Code to find the overall transfer function for the SFG shown
below using Mason’s Gain formula
1 1 1 1 1
𝐺1 = ; 𝐺2 = ; 𝐺3 = ; 𝐺4 = 𝑠; 𝐺5 = ; 𝐺6 = ; 𝐻1 = 2; 𝐻2 = 4; 𝐻3 = 6
𝑠 (𝑠 + 1) (𝑠 + 2) (𝑠 + 3) 𝑠
Exercise Problem:
Write the MATLAB Code
EXPERIMENT NO.3
Input: Output:
Example 1: z=NIL (Empty Column Vector)
n=[10]; P= -7.236, -2.764
d=[1 10 20]; K=10
Example 2: z= -10
n=[1 10]; P= -7.96, -1.091+j1.65, -1.091-j1.65
d=[1 10 20 30]; K=1
EXPERIMENT NO.4
Numerator’); 0.9
0.7
Denominator’); 0.6
Amplitude
c=tf(n,d); 0.5
step(c); 0.4
Den=[1 1] 0.2
0.1
0
0 2 4 6 8 10 12
Time (seconds)
Input: num=[10]
Den=[1 2 10]
e2=0.5;
wn=5;
n2=[wn^2];
d2=[1 2*e2*wn wn^2];
c2=tf(n2,d2);
t=0:0.01:5;
subplot(2,2,2);
step(c2,t);
grid;
e3=0.7;
wn=5;
n3=[wn^2];
d3=[1 2*e3*wn wn^2];
c3=tf(n3,d3);
t=0:0.01:5;
subplot(2,2,3);
step(c3,t);
grid;
e4=0.9;
wn=5;
n4=[wn^2];
d4=[1 2*e4*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;
figure(2)
step(c1,c2,c3,c4);
title('comparision of all the
under damped responses');
legend({'e1=0.2','e2=0.5','e3=
0.7','e4=0.9'});
grid;
Case (iv) Time Response of various
systems
%Types of Responses
%Undampped System
e1=0;
wn=5;
n1=[wn^2];
d1=[1 2*e1*wn wn^2];
c1=tf(n1,d1);
t=0:0.01:5;
subplot(2,2,1);
step(c1,t);
grid;
%Critically dampped System
e2=1;
wn=5;
n2=[wn^2];
d2=[1 2*e2*wn wn^2];
c2=tf(n2,d2);
t=0:0.01:5;
subplot(2,2,2);
step(c2,t);
grid;
%Under damped system
e3=0.5;
wn=5;
n3=[wn^2];
d3=[1 2*e3*wn wn^2];
c3=tf(n3,d3);
t=0:0.01:5;
subplot(2,2,3);
step(c3,t);
grid;
%Over damped system
e4=1.2;
wn=5;
n4=[wn^2];
d4=[1 2*e4*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;
figure(2)
step(c1,c2,c3,c4);
title('comparision of all the
system responses');
legend({'undamped','critically
damped','under damped','over
damped'});
grid;
EXPERIMENT NO. 5
FREQUENCY RESPONSE OF SECOND ORDER SYSTEM
Aim: To draw the frequency response of given second order system
Program:
n=input(‘enter the value of
Numerator’);
d=input(‘enter the value of
Denominator’);
w=0:0.1:2*pi;
freqs (n, d, w);
Input: n=[10]
d=[1 5 25]
EXPERIMENT NO. 6
FREQUENCY RESPONSE OF COMPENSATORS
a) LAG NETWORK
Aim: To draw the response of Lag network
1
(𝑠 + 𝑇)
𝑇(𝑠) = ;𝛽 > 1
1
(𝑠 + )
𝛽𝑇
T=input(‘enter the value of time
constant’);
b=input(‘enter the value of the
constant’);
n=[1 1/T];
d=[1 1/(b*T)];
c=tf(n,d);
bode(c);
grid;
//w=0:0.01:10;
//freqs(n,d,w);
Input: T=5;
b=2;
b) LEAD NETWORK
Aim: To draw the response of Lead network
1
(𝑠 + 𝑇)
𝑇(𝑠) = ;𝛼 < 1
1
(𝑠 + 𝛼𝑇)
T=input(‘enter the value of time
constant’);
a=input(‘enter the value of the
constant’);
n=[1 1/T];
d=[1 1/(a*T)];
c=tf(n,d);
bode(c);
grid;
//w=0:0.01:10;
//freqs(n,d,w);
Input: T=5;
a=0.5;
c) LAG-LEAD NETWORK
Aim: To draw the response of Lead network
1 1
(𝑠 + 𝑇 ) (𝑠 + 𝑇 )
1 2
𝑇(𝑠) = ; 𝛼 < 1; 𝛽 > 1
1 1
(𝑠 + 𝛼𝑇 ) (𝑠 + )
1 𝛽𝑇2
T1=input(‘enter the value of time constant’);
T2=input(‘enter the value of time constant’);
a=input(‘enter the value of the constant’);
b=input(‘enter the value of the constant’);
n1=[1 1/T1];
n2=[1 1/T2];
n=conv(n1,n2);
d1=[1 1/(a*T1)];
d2=[1 1/(b*T2)];
d=conv(d1,d2);
c=tf(n,d);
bode(c);
margin(c);
grid;
EXPERIMENT NO. 7
ANALYZE THE STABILITY OF THE GIVEN SYSTEM USING ROUTH STABILITY CRITERION
Exercise: Write the MATLAB Code to analyze the stability of the characteristic
equation given below:
𝐹(𝑠) = 𝑠 5 + 4𝑠 4 + 8𝑠 3 + 2𝑠 2 + 3𝑠 + 1
EXPERIMENT NO. 8
G(s)=K/s(s+4)(s2+4s+20)
Program: 10
sys=tf(num,den);
rlocus(sys); 0
[K,poles]=rlocfind(sys);
OUTPUT: -5
EXPERIMENT NO. 9
bode(sys);
-150
[gm, pm, wpc, wgc]=margin(sys); -90
margin(sys); -135
Phase (deg)
if(wpc>wgc)
-180
disp(‘system is stable’)
else -225
OUTPUT:
Gain Margin GM=4.73 Db
Gain Cross Over frequency Wgc=1.81 rad/sec
Phase Margin PM=76.3°
Phase Cross Over Frequency Wpc=4.24 rad/sec
EXPERIMENT NO. 10
G(s)H(s)=48/(s4+64s3+320s2+20s+1) 40
sys
Program: 30
Imaginary Axis
sys=tf(num,den); 0
nyquist(sys); -10
margin(sys); -30
if(wpc>wgc) -40
disp(‘system is unstable’)
end
EXPERIMENT NO. 11
Circuit Diagram:
Simulink Model:
𝑑𝑖(𝑡) 1
𝑬𝒒𝒖𝒂𝒕𝒊𝒐𝒏𝒔: 𝐴𝑝𝑝𝑙𝑦 𝐾𝑉𝐿 𝑡𝑜 𝑡ℎ𝑒 𝑙𝑜𝑜𝑝: 𝑅𝑖(𝑡) + 𝐿 + ∫ 𝑖(𝑡)𝑑𝑡 = 𝑉𝑖
𝑑𝑡 𝐶
𝑑𝑖(𝑡) 1
=> = [𝑉𝑖 − 𝑉𝑜 − 𝑅𝑖(𝑡)]
𝑑𝑡 𝐿
1
𝑂𝑢𝑡𝑝𝑢𝑡 = 𝑉𝑜 = ∫ 𝑖(𝑡)𝑑𝑡
𝐶
Procedure:
(i) Open the simulink library browser
(ii) Click Continuous-Integrator;drag and place in the sheet
(iii) Click Math operations-Gain drag and place in the sheet.
(iv) Click Sources to get step input and click sink to get scope.
(v) Connect all the components to get the above simulink model.
(vi) Save the file,run the model and double click on scope to view the
output waveform.
EXPERIMENT NO. 12
%PD Controller
kp=500;
kd=10;
C=pid(kp,0,kd);
P=tf(n,d);
T2=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,3);
step(T2,t);
grid;
%PI Controller
kp=30;
ki=70;
C=pid(kp,ki);
P=tf(n,d);
T3=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,4);
step(T3,t);
grid;
%PID Controller
kp=500;
ki=400;
kd=50;
C=pid(kp,ki,kd);
P=tf(n,d);
T4=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,5);
step(T4,t);
grid;
figure(2)
step(k,T1,T2,T3,T4,'r--
');
title('comparision
of all the responses');
legend({'openloop',
'p_controller',
'pd_controller',
'pi_controller',
'pid_controller'});
legend('boxoff');
grid;
DEMONSTRATION EXPERIMENTS
ADDITIONAL EXPERIMENTS (Not Mandatory to do)
%Transfer Function
J=0.01;B=0.1;K=0.01;
R=1;L=0.5;
n=[K];
d=[0.005 0.06 0.1];
c=tf(n,d)
step(c)
grid;
%Transfer Function
J=0.01;B=0.1;K=0.01;
R=1;L=0.5;
s=tf('s');
P=K/((J*s+B)*(L*s+R)+K^2);
zpk(P);
step(P)
grid;
%State Space
J=0.01;b=0.1;K=0.01;
R=1;L=0.5;
A=[-b/J K/J;-K/L -R/L];
B=[0;1/L];
c=[1 0];
d=[0];
m=ss(A,B,C,D);
step(m);
The above state-space model can also
be generated by converting your existing
transfer function model into state-space
form. This is again accomplished with
the ss command as shown below.
m1=ss(P);
The open-loop step response can also be generated directly within Simulink, without
extracting any models to the MATLAB workspace. In order to simulate the step response,
the details of the simulation must first be set. This can be accomplished by
selecting Model Configuration Parameters from the Simulation menu. Within the
resulting menu, define the length for which the simulation is to run in the Stop time field.
We will enter "3" since 3 seconds will be long enough for the step response to reach
steady state. Within this window you can also specify various aspects of the numerical
solver, but we will just use the default values for this example.
Next we need to add an input signal and a means for displaying the output of our
simulation. This is done by doing the following:
Linearized Model
We then need to identify the inputs and outputs of the model we wish to extract.
First right-click on the signal representing the Voltage input in the Simulink model.
Then choose Linear Analysis Points > Open-loop Input from the resulting menu.
Similarly, right-click on the signal representing the Speed output and select Linear
Analysis Points > Open-loop Output from the resulting menu.
The input and output signals should now be identified on your model by arrow
symbols as shown in the figure below.
In order to perform the extraction, select from the menus at the top of the model
window Analysis > Control Design > Linear Analysis.
This will cause the Linear Analysis Tool to open. Within the Linear Analysis
Tool window, the Operating Point to be linearized about can remain the
default, Model Initial Condition.
In order to perform the linearization, next click the Step button identified by a step
response with a small green triangle.
The result of this linearization is the linsys1 object which will appear in the Linear
Analysis Workspace as shown below.
Furthermore, the open-loop step response of the linearized system also will be
generated automatically.
We will further verify the model extraction by looking at the model itself.
The linearized model can be exported by simply dragging the object into
the MATLAB Workspace.
This object can then be used within MATLAB in the same manner as an object
created directly from the MATLAB command line.
Specifically, entering the command zpk(linsys1) in the MATLAB command window
demonstrates that the resulting model has the following form.
𝜽(𝒔)̇ 𝟐
𝑷(𝒔) = =
𝑽(𝒔) (𝒔 + 𝟗. 𝟗𝟗𝟕)(𝒔 + 𝟐. 𝟎𝟎𝟑)