Exp06 EEE318
Exp06 EEE318
Exp06 EEE318
Experiment No. 6
Part A: Sketching Bode Plot with MATLAB’s sisotool
Objective: To sketch Bode plot of a system and find out important parameters from the
plot using MATLAB
Theory:
Frequency response is a representation of the system's response to sinusoidal inputs at
varying frequencies. The output of a linear system to a sinusoidal input is a sinusoid of the
same frequency but with a different magnitude and phase. The frequency response is defined
as the magnitude and phase differences between the input and output sinusoids.
1|Page
Bode Plot
The log-magnitude and phase frequency response curves as functions of are called
Bode plots. The magnitude is plotted in decibels (dB), and the phase in degrees. The decibel
calculation for magnitude is computed as ( ( ) ), where ( ) is the system's
frequency response. Bode plots are used to analyze system properties such as the gain
margin, phase margin, DC gain, bandwidth, disturbance rejection, and stability.
Bode plot of some common terms:
1. Constant gain: For ( ) where K is a constant:
( )
( ) {
( ) ( )
( )
The slope of the magnitude curve of this transfer function is -20dB/decade.
3. Real poles and zeros:
i. Zero of first order: For ( )
( ) {
( ) {
2|Page
ii. Pole of first order: For ( )
( ) {
( ) {
*** Figure 2 and 3 shows that the bode plot of a zero is reflected with respect to frequency axis of the bode
plot of a pole of the same type.
*** A zero or pole of any other form can be converted to this standard form e.g. ( ). This is
called normalization.
If ( ) ( ) ( )
( ) {
( ) {
( ) {
( ) {
3|Page
Near the corner frequency the shape of both the magnitude and phase plot depend on the
value of ξ.
*** Bode plot of complex zeros is just reflection of bode plot of complex poles w.r.t. frequency axis.
If we convert both sides to decibels, the logarithms from the decibel calculations convert
multiplication of the arguments into additions, and the divisions into subtractions then,
∑ ∑
The phase frequency response is the sum of phase frequency response curves of the zero
terms minus the sum of the phase frequency response curves of the pole terms.
∑ ( ) ∑ ( )
Phase margin ФM: The phase margin is the change in open-loop phase shift required at unity
gain to make the closed-loop system unstable.
Figure 5: Gain and phase margin calculations from the Bode plots
4|Page
Figure 5 shows how to evaluate the gain and phase margins by using Bode plots. The gain
margin is found by using the phase plot to find the frequency , where the phase angle is
180°. At this frequency, we look at the magnitude plot to determine the gain margin, GM,
which is the gain required to raise the magnitude curve to 0 dB.
The phase margin is found by using the magnitude curve to find the frequency , where
the gain is 0 dB. On the phase curve at that frequency, the phase margin, ФM, is the difference
between the phase value and 180°.
There is a relationship between phase margin and percent overshoot,
Phase margin,
…………………….(1)
√ √
Percent Overshoot,
( √ )
% …………………….(2)
And there is a relationship between bandwidth and settling time or peak time,
Band width,
√( ) √ …………….(3)
Or,
√( ) √ …………….(4)
√
i. Using code:
s=tf('s');
sys=100/(s^3+12*s^2+20*s); %system transfer function
bode(sys); %drawing the bode
grid on;
[gm,pm,wgc,wpc]=margin(sys); %check the matlab margin function
gm_db=20*log10(gm);
One can also find the parameters directly from the plot by right clicking on the plot and then
Characteristics > All Stability Margins
ii. Using SISOTOOL:
1. Write the following code:
s=tf('s');
sys=100/(s^3+12*s^2+20*s); %system transfer function
sisotool(sys)
2. A new window will open which contains bode plot, root locus, step response etc.
3. You can edit the values of F, C, G and H from ‘Controllers and Fixed Blocks’ where
G: The main system
C: Controller
5|Page
H: Feedback Gain
F: Can be used to find impulse response or ramp response etc.
4. From root locus or Bode plot, one can drag the ‘dot’ to change the value of the
proportional constant K and see the change in Bode plot, root locus, step response etc.
5. You can watch a video on https://www.youtube.com/watch?v=Ta4eh7gCBDE to get
more knowledge about the sisotool.
Prelab:
Labwork:
1. Draw the bode plot of Prelab 1 using MATLAB code.
2. Draw the bode plot of ( ) for 1:10 and see the
change in bode plot for different values of .
3. Draw the bode plot of Prelab 2 using ‘sisotool’. Determine the gain margin, phase
margin and bandwidth. Change the value of the proportional constant by dragging the
bode plot and observe the changes
6|Page
Part B: Compensator Design via Frequency Response
Objective: To design lag, lead and lag-lead compensator via frequency response and to see
the effect these compensators upon the magnitude and phase responses at each step of the
design
Theory:
Gain Adjustment:
By increasing the gain of the open loop, one can shift the magnitude plot upwards without
changing the phase plot. Thus, it can provide the desired phase margin.
Figure 6: Bode plots showing gain adjustment for a desired phase margin
Procedure:
Draw the Bode magnitude and phase plot.
Determine the required phase margin from the percent overshoot by using Eqs.
(1) and (2).
By code: Determine the frequency ( ) that yields the desired phase margin.
Determine the gain at that frequency (AB in figure 6). The magnitude plot
must be shifted upward by AB. Find the gain that yields this shift by using
( ) Draw the compensated Bode plot and check if the design is
right.
By sisotool: Shift the magnitude plot upwards by dragging and check when the
phase margin is met in the phase plot.
Lag Compensator:
Frequency response method can be used to design lead lag compensation. The function of the
lag compensator is to (1) improve the static error constant by increasing only the low-
7|Page
frequency gain without any resulting instability, and (2) increase the phase margin of the
system to yield the desired transient response. These concepts are illustrated in Figure 7.
The lag compensator, while not changing the low-frequency gain, does reduce the high
frequency gain. Thus, the low-frequency gain of the system can be made high to yield a large
without creating instability. This stabilizing effect of the lag network comes about because
the gain at 180° of phase is reduced below 0 dB. Through judicious design, the magnitude
curve can be reshaped, as shown in Figure 2, to go through 0 dB at the desired phase margin.
Thus, both and the desired transient response can be obtained.
The transfer function of lag compensator is
( )
Procedure:
1. Draw the Bode magnitude and phase plot for the system which gives the desired error.
2. Determine the required phase margin from the percent overshoot by using Eqs. (1)
and (2).
By Sisotool:
1. Right click on Bode plot area and select grid. Set proper limits for the axes.
2. Estimate the frequency at which the phase margin occurs. (Normal Bode is better for
this purpose)
3. Right click on the Bode magnitude plot. Select Add Pole/Zero> Real Zero. Add a
zero at a frequency that is 1/10 that found in step 2.
8|Page
4. Right click on the Bode magnitude plot. Select Add Pole/Zero> Real Pole. Add a pole
at the left side of the zero. Move it and check the phase margin from the phase plot.
Stop if the desired phase margin is reached.
Lead Compensator:
The lead compensator increases the bandwidth by increasing the gain crossover frequency. At
the same time, the phase diagram is raised at higher frequencies. The result is a larger phase
margin and a higher phase-margin frequency. In the time domain, lower percent overshoots
(larger phase margins) with smaller peak times (higher phase margin frequencies) are the
results. The concepts are shown in Figure 4.
The uncompensated system has a small phase margin (B) and a low phase margin frequency
(A). Using a phase lead compensator, the phase angle plot (compensated system) is raised for
higher frequencies. At the same time, the gain crossover frequency in the magnitude plot is
increased from A rad/s to C rad/s. These effects yield a larger phase margin (D), a higher
phase-margin frequency (C), and a larger bandwidth.
The transfer function of lag compensator is
( )
9|Page
4. Determine from . Determine the compensator’s magnitude at
( ) .
√
5. Using ( ) find out from the graph. Now calculate T from the
√
6. Now complete the compensator transfer function and add it to the Bode plot.
7. Check if desired phase margin and bandwidth have been achieved. For bandwidth, use
bandwidth() function of MATLAB. It takes the closed loop transfer function as
input.
Lag-Lead Compensator:
Lag-lead compensation improves the transient response and steady-state error. One method is
to design the lag compensation to lower the high-frequency gain, stabilize the system, and
improve the steady-state error and then design a lead compensator to meet the phase-margin
requirements.
The transfer function of a single, passive lag-lead network is
( ) ( ) ( ) ( )( )
Suppose, we want to design a passive lag-lead compensator for a unity feedback system
where ( ) ( )( )
using Bode diagrams to yield a 13.25% overshoot, a peak time of 2
seconds and
1. Using Eqs. (1), (3) and (4), we get a bandwidth of 2.29 rad/s and
2. For So we have to plot the Bode plot of ( ) ( )(
.
)
3. Let us select as the new phase margin frequency. At this frequency,
phase is from Bode plot. So, we need From,
. and β=0.094 and gives us
√
4. For the lag compensator we select the higher break frequency to be 1 decade below
the new phase margin frequency, at 0.18 rad/s. So, . So the transfer function
becomes,
( )
( ) ( )
And
( )
( )( )( )
5. For the lead compensator we can use the data from step 3 for calculation.
10 | P a g e
( )
( ) ( )
Labwork:
1. Using MATLAB’s SISO Design Tool, find the value of K for a unity feedback system
with ( ) ( )(
to yield a 9.5% overshoot in the transient response for a
)
step input. Use only gain adjustment.
2. Using MATLAB’s SISO Design Tool, design a lag compensator for a unity feedback
system with ( ) ( )(
to yield a 9.5% overshoot and a tenfold
)
improvement in the steady state error.
3. Design a lead compensator for a unity feedback system with ( ) to
( )( )
yield a 20% overshoot and a , with a peak time of 0.1 second.
4. Design the lag-lead compensator of the example and note down phase margin, phase
margin frequency, closed loop bandwidth, percent overshoot and peak time for the
lag-lead compensated system.
Report:
1. Describe the effect of gain adjustment, lag compensator, lead compensator and lag-
lead compensator by comparing the phase margin, phase margin frequency, closed
loop bandwidth, percent overshoot and peak time for the uncompensated and
compensated system for each of the case.
2. Discuss the advantages and disadvantages for each of the design.
11 | P a g e