Lab Reports (Control System)
Lab Reports (Control System)
Experiment no 01:
Objective:
Analyzing the output of a transfer function through different signals in MATLAB (Simulink)
Theory:
Transfer function: The ratio of the Laplace transform of the output of a system to the Laplace
transform of the input.
OR
Transfer function is the mathematical representation of a system in frequency domain.
Linearly Time-Invariant System (LTI): LTI system relates the output of the system to its input with
zero initial conditions. The system is fed by the input signals (e.g., unit step or impulse) and the
output is analyzed. The derivative of unit step input produces unit impulse input
Procedure:
• Open the Simulink in MATLAB and then select the step input and transfer function.
• Now set the values of transfer function and then make the connection between input and
transfer function.
• To see the output scope was used.
• In case of unit impulse input add the derivate block between the input and transfer function.
Result:
Simulink Model:
Result:
Simulink Model:
Result:
Experiment no 02:
Objective:
The objective of this lab is to model the system in time domain
Theory:
State Space representation is the time-domain technique for modeling, analyzing and designing a
wide range of systems and applications. State space is represented by state equations and output
equations. The state variables are chosen and once determined are used to specify other system
variables. The state variables are chosen either by phase-variable choice, controller canonical form,
observer canonical form.
Procedure:
MATLAB Code:
num=[1 7 2];
den=[1 9 26 24];
[A,B,C,D]=tf2ss (num, den);
P=[0 0 1;0 1 0;1 0 0];
A=inv(P)*A*P
B=inv(P)*B
C=C*P
MATLAB Code:
A=[-4 -1.5;4 0];
B=[2;0];
C=[1.5 0.625];
D=0;
T=ss(A,B,C,D);
T=tf(T)
Result:
Experiment no 03:
Objective:
Analyzing the stability of a system through different positions of its roots on real axis in MATLAB
(Simulink)
Theory:
The stability of the system is determined by the position of its roots in the s-plane at real axis. If the
roots are in left half plane, system is stable; if at least one root is on right half plane, system is
unstable and if they are at imaginary axis, system is marginally stable. The roots may also be
complex conjugate meaning that they have real as well as imaginary part but still the stability will
depend on placement in left or right half plane.
Procedure:
MATLAB:
Simulink:
• Open the Simulink in matlab and then select the step input and transfer function.
• Now set the values of transfer function and then make the connection between input and
transfer function.
• To see the output scope was used.
MATLAB Code:
num1=[1];
den1=[1 2 1];
r1=roots(den1)
Simulink Model:
Result:
MATLAB code:
num1=[1];
den1=[1 -2 1];
r1=roots(den1)
Result:
Simulink Model:
Result:
Experiment no 04:
Objective:
The aim of the lab is to connect the subsystems in different configurations for analysis.
Procedure:
• Open the Simulink in MATLAB and then select the step input and transfer function.
• Now set the values of transfer function and then make the connection between input and
transfer function.
• To see the output scope was used.
• In case of Cascade system interconnection different transfer function blocks were used.
Equivalent system:
• In case of Equivalent system all transfer functions combined together and only single block
was used.
• In this case first step input applied to each transfer function and then added together.
• The step function is the input to the transfer function G(s) and the output of the G(s) is
provided as an input to the H(s)and the output of H(s) is feedback to the G(s).
Simulink model:
Result:
Equivalent system:
Simulink Model:
Equivalent system:
Simulink Model:
Result:
Simulink model:
Result:
Result:
Experiment no 05:
Objective:
The objective of this lab to analyze the steady state error analysis for different test signals in
Simulink.
Theory:
Steady state error is the difference between the input and the output for the prescribed test input as t
(time) approaches to infinity.
Procedure:
• Open the Simulink in MATLAB and then select the step input and transfer function and gain
block.
• Now make the model for step input, ramp input and for parabolic input.
Simulink Model:
For Step Input:
For k=500:
For k=5000:
For k=500:
For k=5000:
For k=50:
For k=500:
For k=5000:
Experiment no 06:
Theory:
Root locus: The locus of closed-loop poles as a system parameter is varied. Typically, the parameter
is gain. The locus is obtained from the open-loop poles and zeros.
Procedure:
MATLAB Code:
num = [1 1]
den = conv([1 0],[.5 1])
g = tf(num,den);
rlocus(g)
Result:
MATLAB Code:
num = [1]
den = poly([0 -1 -2])
g = tf(num,den);
rlocus(g
Result:
num = [1 6]
den = conv([1 3],[1 6])
g = tf(num,den);
rlocus(g)
Result:
Experiment no 07:
Objective:
To determine
I. Effect of PI controller on system performance
II. Effect of PD controller on system performance
Theory:
Proportional-plus-derivative (PD) controller: A controller that feeds forward to the plant a
proportion of the actuating signal plus its derivative for the purpose of improving the transient
response of a closed-loop system.
Proportional-plus-integral (PI) controller: A controller that feeds forward to the plant a proportion
of the actuating signal plus its integral for the purpose of
improving the steady-state error of a closed-loop system.
Proportional-plus-integral-plus-derivative (PID) controller: A controller that feeds forward to the
plant a proportion of the actuating signal plus its integral plus its derivative for the purpose of
improving the transient response and steady-state error of a closed-loop system.
MATLAB code:
num=1;
den=[1 10 20];
g1=tf (num,den)
t1=feedback(g1,1)
step(t1,'g')
hold on
num1=10;
den1=[1 10 20];
g2=tf (num1,den1)
t2=feedback(g2,1)
step(t2,'m')
hold on
Kp=500;
Kd=10;
Result:
MATLAB code:
num=1;
den=[1 10 20];
g1=tf (num,den)
t1=feedback(g1,1)
step(t1,'g')
hold on
num1=10;
den1=[1 10 20];
g2=tf (num1,den1)
t2=feedback(g2,1)
step(t2,'m')
hold on
Kp=500;
Ki = 1
numc=[Kp Ki];
denc= [1 0]
numo=conv(numc,num)
deno=conv(den,denc)
g3=tf(numo,deno)
t3=feedback(g3,1)
step(t3,'b')
hold on
Kp=500;
Ki = 100
numc=[Kp Ki];
denc= [1 0]
numo=conv(numc,num)
deno=conv(den,denc)
g3=tf(numo,deno)
t4=feedback(g3,1)
step(t4,'r')
hold on
Kp=500;
Ki = 500
numc=[Kp Ki];
denc= [1 0]
numo=conv(numc,num)
deno=conv(den,denc)
g3=tf(numo,deno)
t5=feedback(g3,1)
step(t5,'g')
hold on
Experiment no 08:
Objective:
To study
I. Effect of addition of zeros to forward path of a open loop system.
II. Effect of addition of zeros to forward path of a closed loop system.
Theory:
The forward path transfer function of general second order system is given by,
MATLAB Code:
n1=1
d1=[1 1 0]
g1=tf(n1,d1)
t1=feedback(g1,1)
step(t1,'r')
hold on
Tz=0.5
Z1=[Tz 1]
n2=conv(n1,Z1)
g2=tf(n2,d1)
t2=feedback(g2,1)
step(t2,'b')
hold on
Tz=1
Z2=[Tz 1]
n3=conv(n1,Z2)
g3=tf(n3,d1)
t3=feedback(g3,1)
step(t3,'y')
hold on
Tz=2
Z3=[Tz 1]
n4=conv(n1,Z3)
g4=tf(n4,d1)
t4=feedback(g4,1)
step(t4,'g')
hold on
Tz=3
Z4=[Tz 1]
n5=conv(n1,Z4)
g5=tf(n5,d1)
t5=feedback(g5,1)
step(t5,'m')
Matlab Code:
n1=[1]
d1=[1 1 1]
t1=tf(n1,d1)
step(t1,'r')
hold on
Tz=0.5
Z1=[Tz 1]
n2=conv(n1,Z1)
t2=tf(n2,d1)
step(t2,'b')
hold on
Tz=1
Z2=[Tz 1]
n3=conv(n1,Z2)
t3=tf(n3,d1)
step(t3,'y')
hold on
Tz=2
Z3=[Tz 1]
n4=conv(n1,Z3)
t4=tf(n4,d1)
step(t4,'g')
hold on
Tz=3
Z4=[Tz 1]
Result:
Experiment no 09:
To study
I. Effect of addition of poles to forward path of a open loop system.
II. Effect of addition of poles to forward path of a closed loop system.
Theory:
The forward path transfer function of general second order system is given by,
For G(s)=1/s*(s+2):
Result:
MATLAB Code:
n1=1
d1=[1 0.6 1]
t1=tf(n1,d1)
step(t1,'r')
hold on
Tp=1
P1=[Tp 1]
d2=conv(d1,P1)
t2=tf(n1,d2)
step(t2,'g')
hold on
Tp=2
P2=[Tp 1]
d3=conv(d1,P2)
t3=tf(n1,d3)
step(t3,'b')
hold on
Tp=4
P3=[Tp 1]
d4=conv(d1,P3)
t4=tf(n1,d4)
step(t4,'m')
Result:
Experiment no 10:
Objective:
To determine
I. Bode plot of a 2nd order system
II. Frequency domain specification parameter
Theory:
Bode diagram (plot): A sinusoidal frequency response plot where the magnitude response is plotted
separately from the phase response. The magnitude plot is dB versus log v, and the phase plot is
phase versus log v. In control systems, the Bode plot is usually made for the open-loop transfer
function. Bode plots can also be drawn as straight-line approximations.
For G(s) =s+1 / s(1+0.5s) :
Matlab Code:
num = [1 1]
den = conv([1 0],[.5 1])
g = tf(num,den);
bode(g)
margin(g)
Result:
Matlab code:
num = [4 8]
den = conv([1 0],[1 15 50])
g = tf(num,den);
bode(g)
margin(g)
Result:
Question:
Answer:
The gain margin Gm is defined as 1/G where G is the gain at. the -180 phase crossing. The gain
margin in dB is derived by Gm_dB = 20*log10(Gm) The phase margin Pm is in degrees.
Question:
Answer:
The greater the Gain Margin or Phase Margin (PM), the greater will be the stability of the system.
The phase margin refers to the amount of phase, which can be increased or decreased without
making the system unstable.
Answer:
The phase crossover frequency is the frequency at which the phase angle first reaches −180° and thus
is the point where the Nyquist plot crosses the real axis.
Experiment no 11:
Objective:
To determine Nyquist plot of a 2nd order system
Theory:
Nyquist criterion: If a contour, A, that encircles the entire right half-plane is mapped through
G(s)H(s), then the number of closed-loop poles, Z, in the right half-plane equals the number of open-
loop poles, P, that are in the right half-plane minus the number of counterclockwise revolutions, N,
around -1, of the mapping; that is, Z =P-N. The mapping is called the Nyquist diagram of G(s)H(s).
num = [1 2]
den = conv([1 1], [1 -1])
g = tf(num,den);
nyquist(g)
Result:
num = [1]
a=[1 0]
b= [1 2 2]
den =conv(a,b)
g = tf(num,den)
nyquist(g)
Result:
Matlab code:
num = [1 3]
den = conv([1 0],[1 6], [1 8])
g = tf(num,den)
nyquist(g)
Result:
Question:
Answer:
The Nyquist contour is a closed contour in the s-plane which completely encloses the entire right-
hand half of s-plane. In order to enclose the complete RHS of s-plane a large semicircle path is
drawn with diameter along jω axis and center at the origin.
Question:
Answer:
Nyquist plot is a stability analysis which uses a polar plot, but saying it explicitly a polar plot creates
some confusion and gives meaning of polar coordinates of mathematics. The Polar plot is a plot,
which can be drawn between the magnitude and the phase angle of G(jω)H(jω) by varying ω from
zero to ∞.
Experiment no 12:
Objective:
For K<2, design a system (second order) with the following characteristics:
• Percent overshoot < 50
• Damping ratio > 0.2
• Stable system
Theory:
Percent overshoot:
Systems may be stable system, unstable system and marginally stable system. A stable system
may overshoot for some values at the start before coming to the stable level. Similarly, in this lab a
system is designed whose percent overshoot is <50.
Damping ratio:
Damping ratio is a parameter that indicates that whether system is over damped(ς>1),
underdamped((ς<1) or critically stable((ς=1). In this lab a system is designed which must have
damping ratio > 0.2.
Stable system:
Third condition which the system must satisfy is it must be stable for K<2, also all the values
(damping ratio and % overshoot) are set. It must be unstable for K>=2
Procedure:
MATLAB Code:
num=[0 0 -1];
den=[1 3 2];
sys=tf(num,den)
sisotool(sys)