Lab7 1
Lab7 1
OBJECTIVE
2. APPARATUS
I. Laptop.
II. Lecture Notes.
III. MATLAB Software.
Figure 7.1: Nyquist plot of the given system G.
In this experiment we’re going to do the stability The code provided generates a Nyquist plot of
analysis by observing various plot and graph. the transfer function G(s) = 1/(s^2+0.8s+1)
The stability refers to the system stat stays in using MATLAB's built-in function 'nyquist'.
desirable state and gives desired output despite a. What does output graph represent?
all the disturbance.
A Nyquist plot is a graphical representation of
LAB TASK: 1 the frequency response of a system. It is used to
In lab task 1 we will analyze the Nyquist plot of analyze the stability and performance of a
the given system, system in the frequency domain. The plot shows
the relationship between the magnitude and
1 phase of the frequency response of the system.
G(s) = 2
𝑠 +0.8𝑠+1 The Nyquist plot is a polar plot, where the
MATLAB Code: magnitude of the frequency response is plotted
on the radial axis, and the phase shift is plotted
By using the MATLAB code shown below we on the angular axis. The plot consists of a series
will observe the Nyquist plot of the gives of points that represent the response of the
system G(s) of the lab task 1. system at different frequencies. The Nyquist plot
%--Given System can be used to determine the stability of a system
G(s)=1/(s^2+0.8s+1)--% by analyzing the number of encirclements of the
%--------Nyquist plot----------- -1 point. The -1 point is the frequency at which
% the system gain becomes 0 dB, and the phase
num=[0 0 1]; shift becomes -180 degrees. In summary, the
den=[1 0.8 1]; Nyquist plot is a tool used in control systems
nyquist(num,den); engineering to analyze the frequency response
axis(v) and stability of a system.
grid b. What are the stability criteria? Or when
title('Nyquist plot of will the system represented by the graph be
G(s)=1/(s^2+0.8s+1)') stable or unstable?
xlabel('Real axis')
ylabel('Imag axis') The Nyquist plot can be used to determine the
hold on stability of a system using the following criteria:
Result:
The system is stable if the Nyquist plot does not
From the MATLAB code of lab task 1 we have
encircle the point (-1,0) in the clockwise
got a Nyquist plot of given system G(s) which is
shown below in Figure 7.1. direction. The number of encirclements of the
point (-1,0) in the counterclockwise direction is
equal to the number of poles of the transfer root locus plot of the given transfer function G(s)
function that lie in the right half of the s-plane. which is shown below in Figure 7.2.
If there are no poles in the right half of the s-
plane, then the system is stable if the Nyquist
plot does not encircle the point (-1,0) in the
clockwise direction. If the Nyquist plot passes
through the point (-1,0), the system is marginally
stable. If the Nyquist plot encircles the point (-
1,0) in the clockwise direction, the system is
unstable. These criteria are based on the
relationship between the Nyquist plot and the
complex plane of the transfer function.
LAB TASK: 2
In lab task 2 we will observe the root locus plot
of the gives system G(s). Figure 7.2: Root locus plot of given system G
The given transfer function is, Analysis:
𝑘(𝑠 2 +2𝑠+4) The code generates a root locus plot of the given
G(s) = transfer function, which is defined by the
𝑠(𝑠+4)(𝑠+6)(𝑠 2 +1.4𝑠+1) numerator and denominator arrays. The 'rlocus'
function is used to generate the root locus plot,
and it takes the numerator and denominator of
MATLAB Code: the transfer function as input. The plot shows the
%---conditionally stable system- locus of the poles of the transfer function as the
-% parameter k varies from 0 to infinity.
%---Given System
a. What output graph represent?
G(s)=k(s^2+2s+4)/[s(s+4)(s+6)(s^
2+1.4s+1)-----% A Root Locus plot is a graphical representation
clc; of the closed-loop poles of a feedback control
close all; system as a parameter, typically the gain, is
clear all;
varied. It is a useful tool for analyzing the
%--------Root Locus----------%
numz=[0 0 0 1 2 4]; stability and performance of a control system.
denp=[1 11.4 39 43.6 24 0]; The plot shows the locations of the closed-loop
r=rlocus(numz,denp); poles as the gain is varied from zero to infinity.
plot(r,'o'); The Root Locus plot is a plot of the locations of
axis(v) the poles of the closed-loop transfer function in
grid
the s-plane. The poles represent the closed-loop
title('Root locus plot of
G(s)=k(s^2+2s+4)/[s(s+4)(s+6)(s^ response of the system to an input signal. The
2+1.4s+1)]') Root Locus plot shows how the locations of the
xlabel('real axis') poles change as the gain of the system is varied.
ylabel('imag axis') The poles move along curves in the s-plane,
hold which are called the Root Loci. The Root Locus
plot shows the trajectories of the poles and the
The output of the above MATLAB code is given
below in the result. locations where the poles cross the imaginary
Result: axis.
From the figure we can see the output of the b. What are the stability criteria? Or when
MATLAB code of the task 2 which shows the will the system represented by the graph be
stable or unstable?
The stability criteria for the Root Locus plot are
as follows:
The system is stable if all the closed-loop poles
are located in the left-half of the s-plane. The
number of poles that lie on the real axis of the s-
plane is equal to the number of open-loop poles
that lie to the right of the imaginary axis. The
gain required to achieve a stable system can be
determined by finding the value of the gain at the
point where the Root Locus intersects the
imaginary axis. If the Root Locus intersects the
imaginary axis at a point that is to the right of an
odd number of poles and zeros, the system is
Figure 7.3: Bode plot of the given system G.
unstable. If the Root Locus intersects the
Analysis:
imaginary axis at a point that is between two A Bode plot is a graphical representation of the
poles or zeros, the system is marginally stable. frequency response of a transfer function. It
LAB TASK: 3 shows the magnitude and phase of the transfer
Here we will observe the Bode plot of the given function as a function of frequency. The Bode
system. plot consists of two plots: the magnitude plot and
The given transfer function is, the phase plot.
a. What does each output graph represent?
(𝑠 3 +2𝑠+3) The magnitude plot shows the magnitude of the
G(s) = 5 4 3 2 transfer function in decibels (dB) as a function
𝑠 +𝑠 +𝑠 +𝑠 +𝑠+1)
of frequency in logarithmic scale. The
MATLAB Code:
By using the MATLAB code below, we will magnitude plot indicates how the amplitude of
generate the output of the given transfer the input signal is affected by the system at
function. different frequencies. The plot displays the gain
%---Given of the system as a function of frequency, and it
System=s^3+2s+3/(s^5+s^4+s^3+s^2 is used to analyze the frequency response of the
+s+1)---%
system. The slope of the magnitude plot changes
%--------Bode Plot ----------%
numg=[1 0 2 3]; at the corner frequencies, which are the
deng=[1 1 1 1 1 1 ]; frequencies at which the poles and zeros of the
'G(s)' transfer function are located.
u=tf(numg,deng); b. What are the stability criteria? Or when
bode(u) will the system represented by the graph be
grid stable or unstable?
hold The stability criteria for a Bode plot are based on
title('Bode plot of the phase margin and gain margin of the system.
G(s)=s^3+2s+3/(s^5+s^4+s^3+s^2+s
The phase margin is the amount of additional
+1)')
[Gm,Pm,Wcg,Wcp] = margin(u) phase shift required to make the system unstable,
Gm_dB = 20*log10(Gm) and the gain margin is the amount of additional
Result: gain required to make the system unstable. The
By executing the above MATLAB code I have stability criteria for a Bode plot are as follows:
generated the output of the code which is Bode LAB TASK: 4
plot of the given transfer function and which is In lab task 4 we will observe the polar plot.
shown below in Figure 7.3. MATLAB Code:
To observe the polar plot I have used this
MATLAB code which will show the polar plot.
clc processing and control design, named after
format compact American engineer Nathaniel B. Nichols.
set(gcf,'Toolbar','none','Name',
MATLAB Code:
'Polar Plot', ...
By using the MATLAB code mentioned below
'NumberTitle','off','Position',[
we will observe the Nicholas Plot from its
10,350,350,300]);
output.
theta = 2*pi*linspace(0,1,30);
r = 2*(1 + cos(theta)); %Plot the Nichols response of
polar(theta,r,'r-') the system
set(gca,'Position',[0.1 0.1 0.75 num = [-4 48 -18 250 600];
0.75]); den = [1 30 282 525 60];
title('\bf\itA Polar H = tf(num,den)
Plot','Color','k','VerticalAlign nichols(H);
ment','bottom') ngrid
textstr(1)={'r = Result:
2(1+cos\theta)'}; This is the output of the above-mentioned
textstr(2)={'\theta = 0 -> MATLAB code which represents Nicholas plot
2\pi'}; shown in Figure 7.5.
text(5*cos(pi/4),5*sin(pi/4),
...
strcat(textstr))
title('Polar plot ')
hold
Result:
This is the result I have got from the above code
which shows the polar plot in Figure 7.4.