0% found this document useful (0 votes)
29 views3 pages

Exp3 4

This document discusses frequency response analysis using Nyquist and Bode plots in MATLAB. It provides examples of using the nyquist() and bode() functions to generate polar and Bode plots, respectively, for various open-loop transfer functions. It also explains how to calculate gain and phase margins from the Bode plots graphically and using the margin() function. Exercises are included to generate plots for additional transfer functions and find their gain and phase margins.

Uploaded by

Ayman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Exp3 4

This document discusses frequency response analysis using Nyquist and Bode plots in MATLAB. It provides examples of using the nyquist() and bode() functions to generate polar and Bode plots, respectively, for various open-loop transfer functions. It also explains how to calculate gain and phase margins from the Bode plots graphically and using the margin() function. Exercises are included to generate plots for additional transfer functions and find their gain and phase margins.

Uploaded by

Ayman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Exp 3: Frequency response using Nyquist plot

1. OBJECTIVES
✓ To use MATLAB commands for frequency response analysis.
✓ To understand frequency response analysis using Polar Plot.
✓ To find gain and phase margin using Polar Plot.
2. Polar Plot
The most commands used for polar Plot are
nyquist (num,den)
nyquist (num,den,w)
We can also obtain arguments by
[re,im,w]= nyquist (num,den,w)
where the frequency response returns real and imaginary with respective to w.
Example1:
Given a unity feedback control system with open-loop transfer function given by
1
Go (s ) = , Obtain the polar plot
(0.1s + 1)

Solution1:

num= l
den= [. 1 1 ] ;
w=[0:.1:1000);
[re,im , w) = nyqui s t (num,den,w);
[phase,ma g] = cart2pol(re,im);
polar(phase,rnaq);
title ( 'G (s) =1 / [ (0 . l s +l ) l ' )
Ta ble=[w mag rad2deg(phase) );

Exercises:
Find polar plot for below open loop transfer functions
100 1 1 1
G o (s ) = , G1 (s ) = , G 2 (s ) = , G 3 (s ) =
(s 2 + 10s + 100) (s + 1)(s + 2) (s + 1)(s + 2)(s + 3) s (s + 1)(s + 2)
Exp 4: Frequency response using Bode plot

1. OBJECTIVES
✓ To understand frequency response analysis using Bode Plot.
✓ To find gain and phase margin using Bode Plot.
2. Bode Plot
The most commands used for polar Plot are
bode (num,den)
bode (num,den,w)
where num and den is the numerator and denominator of open-loop transfer function
respectively and w (optional) is the frequency range of the response.
We can also obtain arguments by
[mag,phase]= bode (num,den,w)
where the frequency response returns magnitude and phase angle with respective to w.
Example1:
Given a unity feedback control system with open-loop transfer function given by
1
Go (s ) = , Obtain the bode plot
(0.1s + 1)

Solution1:
num=l
den=[ . 1 1];
w=[0: . 1: 1000];
[mag,phase] = bode (num,den , w) ;
format shortG
Tabl.e=[w' 20*log10 (mag) phase] % Store in a Tab'le
bode(num, den, w), grid;
title ( ' G(s)=l/ [ (0 .1s+l)] ')

Exercises:
Find bode plot for below open loop transfer functions
100 1 1 1
G o (s ) = , G1 (s ) = , G 2 (s ) = , G 3 (s ) =
(s 2 + 10s + 100) (s + 1)(s + 2) (s + 1)(s + 2)(s + 3) s (s + 1)(s + 2)

3. Finding Gain and phase margins


3.1 Graphically
The gain margin is defined as the change in open loop gain required to make the system
unstable.
Gain margin, in dB, from Bode plot = - the magnitude of G(s) when the phase angle = -180.
The phase margin is defined as the change in open loop phase shift required to make a closed
loop system unstable.
Phase margin from Bode plot = the difference of phase between -180 degree and the phase of
G(s) when the magnitude =0dB (i.e. the intersection with the line 0dB)
3.2 Using “margin” command
It is also possible to use the command “margin” command as below
[Gm,Pm,Wcg,Wcp] = margin(num,den)
where
Gm is gain margin, Pm is phase margin, Wcg is gain crossover frequency and Wcp is phase
crossover frequency.
The phase margin Pm is in degrees. The gain margin Gm is an absolute magnitude. You can
compute the gain margin in dB by
Gm_dB = 20*log10(Gm)
Example2:
1 1
Find gain and phase margin for G 2 (s ) = and G 3 (s ) =
s (s + 1)(s + 2) (s + 1)(s + 2)(s + 3)
Solution2:
% G(s)=l/ [s (s+l) (s+2)]
num= [1] ;
den=[l 3 2 0];
w=[0: .1:100];
[mag,phase] = bode(num,den,w);
format shortG
Table=[w' 20*logl0(mag) phase,] % store in a Table
margin(num,den);
title ( ' G (s) =1/ [s (s+l) (s+2)] ' )

G 3 (s ) to be done by students.
Example3:
Write a code to draw Bode plot for a user defined G(s) and frequencies. Run this code for
two G(s) selected by your module tutor then find Gm,Pm,Wcg,Wcp graphically. Check
for both G(s) using “margin” command.
Solution3:
% G(s) to be given by user
num=input( 'Enter num • );
den=input( 'Enter den ' );
w=input( 'Frequency range' );
[mag,phase] = bode(num,den,w);
format shortG
Table=[w' 20*log10 (mag) phase,] % store in a Table
bode(num,den,w), grid;
Remark: all codes of this experiment were written by the module leader “Dr. Ayman Al-Khazraji”

You might also like