exp-4,Bode_plot
exp-4,Bode_plot
Experiment No:4
Name of the Experiment: To obtain Bode magnitude and phase plot of the transfer
function using MATLAB.
Submitted on:
Aim: To obtain Bode magnitude and phase plot of the transfer function using
MATLAB.
Prerequisite:
knowledge of various types of signals
Idea about software MATLAB
Objective:
To judge the stability of the system from its open loop transfer function.
To find the margin of the system both in terms of gain &phase in which
system parameters can be varied to work in stability mode.
THEORY:
For a simple pole, the log magnitude plot at frequencies much lower than the
corner frequency
can be approximated by the constant (horizontal) 0 dB line, while at
frequencies
For a simple zero, the log magnitude plot at frequencies much lower than the
corner frequency
can be approximated by the constant (horizontal) 0 dB line,
The main application of the Bode plot is to determine the relative stability of
closed loop systems. The stability of these systems can be investigated by:
(i) phase margin PM
(ii) gain margin GM
3. Phase margin: It is defined as the amount of additional phase lag at the gain
crossover frequency, required to bring the system on the verge of instability.
The gain crossover frequency is the frequency at which the magnitude, ,
of the open-loop transfer function is unity (0 dB). The phase margin, PM, is
180 plus the phase angle of the open-loop transfer function at the gain
crossover frequency, or
PM = 180 +
From the Bode plot, PM is obtained as the vertical distance in degrees between
the phase locus and the = -180 axis at the gain crossover frequency. PM is
defined as positive if the phase locus is above the = -180 axis. For a
minimum phase system to be stable, PM must be positive.
To plot the bode plot using MATLAB, the functions used are bode and
logspace. The bode function is used to generate a bode diagram and the
logspace function generates a logarithmically spaced vector of frequencies
utilized by the bode function.
close all;
subplot(2,1,1);
num=[0 9 1.8 9];
den=[1 1.2 9 0];
w=logspace(-2,3,100);
[mag,phase,w] = bode(num,den,w);
%convert mag to decibels
magdB = 20*log10(mag);
%Specify the range for magnitude.
dBmax= 50*ones(1,100);
dBmin= -50*ones(1,100);
To plot the magnitude(dB), enter the 'semilogx' command %which selects a
semilog scale on the X axis.
semilogx(w,magdB,’o’,w, magdB,’-’,w, dBmax,’-’,w, dBmin,’-’)
grid %Enter grid, title, xlabel and ylabel.
%To obtain the gain and phase margins use the 'margin' command which
derives
%the gain and phase margins from the Bode magnitude, phase, and frequency
vectors
%'mag', 'phase', and 'w' produced by 'bode'. Interpolation is performed
%between the frequency points to estimate the values.
[Gm,Pm,wgc,wpc] = margin(mag,phase,w);
Gm_dB = 20*log10(Gm);
legend('gainmargin = ',num2str(Gm_dB),'dB','phase margin =
',num2str(Pm),'degrees');
figure;
margin(sys);
4. PROCEDURE:
1)Run the program for Bode plot ( named bode_plot.m) by assigning different
values of wn and ζ for a second order system(for example (wn, ζ ) = (1.0, 0.2),
(1.0, 0.4), (1.0, 0.6), (1.0, 0.8), (1.0, 1.0), (1.0, 1.2), (1.0, 1.4), (2.0, 0.6), (2.0,
1.0), (2.0, 1.2) etc.). Observe the output response and note the values of Gain
margin and Phase margin obtained from the program.
2)Run the program for general systems of higher order given below:
a) G(s)H(s) = 16/s(s2+5*s+121)
b) G(s)H(s) = 100(s+4)/s(s+0.5)(s+10)
c) G(s)H(s) = 900(s+1)/s2(s+10)(s+400)
d) G(s)H(s) = 6(s+2)(s+6)/s2(s2+18*s+400)
Note the Gain margin, Phase margin Gain crossover frequency and Phase
crossover frequency for each of the system.
5. CONCLUSIONS: