You are on page 1of 10

EPM2036 Control Theory CT2: Frequency Response Analysis

1. Objectives
(i) (ii) To analyze the frequency response of a system using Bode plot. To design a suitable controller to meet frequency domain and time domain performance criteria.

2. Introduction
The frequency response is a representation of a 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 possibly with a different magnitude and phase. The frequency response is defined as the measure of any system's response at the output to a signal of varying frequency (but constant amplitude) at its input. In this lab session, we will see how we can use the open loop frequency response of a system to predict its behavior in closed loop. To plot the frequency response, we create a vector of frequencies (varying between zero or dc and infinity) and compute the value of the systems transfer function at these frequencies. If G(s) is the open loop transfer function of a system and is the frequency vector, we then plot G(j ) vs. . Since G(j ) is a complex number, we can plot both its magnitude and phase (the Bode plot) or its position in the complex plane (the Nyquist plot). Bode plot A Bode plot is the representation of the magnitude and phase of G(j ) (where the frequency vector contains only positive frequencies). To see the Bode plot of a transfer function, you can use the MATLAB bode command. For example, bode(50,[1 9 30 40]) 50 . Please note the axes s + 9 s + 30s + 40 of the figure. The frequency is in logarithmic scale, the magnitude is given in decibels (top) and the phase is given in degrees (bottom). displays the Bode plots for the transfer function G ( s ) =
3 2

Note: Decibel is defined as 20 log10 (|G(j )|).

Gain margin and phase margin The gain margin is defined as the change in open loop gain required to make the closed loop system unstable. Systems with greater gain margins can withstand greater changes in system parameters before becoming unstable in closed loop. Keep in mind that unity gain in magnitude is equal to a gain of zero in dB. On the Bode plot, the gain margin is the difference between the magnitude curve and 0dB at the phase cross over frequency, Wpc. Wpc is the frequency that gives us a phase of -180 degrees. The phase margin is defined as the change in open loop phase shift required to make a closed loop system unstable. The phase margin also measures the system's tolerance to time delay. On the Bode plot, the phase margin is the difference in phase between the phase curve and -180 degrees at the gain cross over frequency, Wgc. Wgc is the frequency that gives us a gain of 0dB.

Adding gain shifts the magnitude plot upwards. For example, suppose you entered the command bode(50,[1 9 30 40]) You will get the following Bode plot:

You can see that the phase margin is about 100 degrees. Now suppose you add a gain of 100, by entering the command bode(100*50,[1 9 30 40]) You should get the plot shown below.

As you can see the phase plot is exactly the same as before, and the magnitude plot is shifted up by 40dB (gain of 100). From the plot, the phase margin is now about -60 degrees. A negative value for either the gain margin or the phase margin indicates that the closed loop is unstable. We can find the gain and phase margins for a system directly, by using MATLAB. Just enter the margin command. This command returns the gain and phase margins, the gain and phase cross 3

over frequencies, and a graphical representation of these on the Bode plot. Let's check it out by typing margin(50,[1 9 30 40])

Bandwidth frequency The bandwidth frequency is defined as the frequency at which the closed loop magnitude response is equal to -3 dB. However, when we design via frequency response, we are interested in predicting the closed loop behavior from the open loop response. Therefore, we will use a second-order system approximation and say that the bandwidth frequency equals the frequency at which the open loop magnitude response is between -6 and -7.5dB, assuming that the open loop phase response is between -135 degrees and -225 degrees. In order to illustrate the importance of the bandwidth frequency, we will show how the output changes with different input frequencies. We will find that sinusoidal inputs with frequency less than Wbw (the bandwidth frequency) are tracked reasonably well by the system. Sinusoidal inputs with frequency greater than Wbw are attenuated (in magnitude) by a factor of 0.707 or greater (and are also shifted in phase). Let's say that we have the following closed loop transfer function representing a system: 1 GCL ( s ) = 2 s + 0.5s + 1 First of all, find the bandwidth frequency from the Bode plot by typing bode (1, [1 0.5 1 ]) 4

Since this is the closed loop transfer function, the bandwidth frequency is the frequency corresponding to a gain of -3 dB, which is approximately 1.4 rad/s. We can also read from the plot that for an input frequency of 0.3 rad/s, the output sinusoid should have a magnitude of about one and the phase should be shifted by a few degrees behind the input. For an input frequency of 3 rad/s, the output magnitude should be about -20dB (or 1/10 of the input) and the phase should be nearly -180 degrees (almost out of phase with the input). We can use the lsim command to simulate the response of the system to sinusoidal inputs. First, consider a sinusoidal input with a frequency lower than Wbw. We must also keep in mind that we want to view the steady-state response. Therefore, we will modify the axes in order to see the steady-state response clearly (ignoring the transient response). w= 0.3; num = 1; den = [1 0.5 1 ]; t=0:0.1:100; u = sin(w*t); [y,x] = lsim(num,den,u,t); plot(t,y,t,u) axis([50,100,-2,2])

Note that the output (blue) tracks the input (purple) fairly well; it is a few degrees behind the input as expected. However, if we set the frequency of the input higher than the Wbw for the system, we get a very distorted response (with respect to the input): w = 3; num = 1; den = [1 0.5 1 ]; t=0:0.1:100; u = sin(w*t); [y,x] = lsim(num,den,u,t); plot(t,y,t,u) axis([90, 100, -1, 1])

Again, note that the magnitude is about 1/10 that of the input, as predicted, and that it is almost exactly out of phase (180 degrees behind the input). Feel free to experiment and view the response for several different frequencies, and see if they match the Bode plot. Closed loop performance In order to predict closed loop performance from open loop frequency response, we need to have several concepts clear: The system must be stable in open loop if we are going to design via Bode plots. If the gain cross over frequency is less than the phase cross over frequency (i.e. Wgc < Wpc), then the closed loop system will be stable. For second-order systems, the closed loop damping ratio is approximately equal to the phase margin divided by 100 if the phase margin is between 0 and 60 degrees. We can use this concept with caution if the phase margin is greater than 60 degrees. A very rough estimate that you can use is that the bandwidth is approximately equal to the natural frequency.

3. Example system
Let us use the concepts above to design a controller for the following system: R + where G ( s ) = 10 . 1.25s + 1 e Controller GC(s) u Plant G(s) Y

The design must meet the following specifications: Zero steady-state error. Settling time must be less than 2 seconds. Phase margin must be at least 30 degrees.

4. Procedures
4.1 Original system without controller (i) In order to plot the Bode plot, create an m-file with the following code: num = 10; den = [1.25,1]; bode(num, den) Since the Bode plot of this system is a horizontal line at low frequencies (slope = 0), we know this system is of type zero. (ii) Check the phase margin and gain cross over frequency and record them in Table 1 (row 1). (iii) Extend the low frequency asymptote in the Bode plot to the = 1 line and read the magnitude at the intersection of the low frequency asymptote with the = 1 line. You should get a gain of 20dB, which means that the magnitude is 10. This means that the step error constant KP = 10. The steady-state error is 1/(1+KP) = 1/(1+10) = 0.091. (iv) Check the step response plot by adding the following two lines of code into the MATLAB command window: [numc,denc] = cloop(num,den,-1); step(numc,denc)

4.2 System with integral controller (i) Incorporate an integral term to yield zero steady-state error for a step input. Change your m-file to the following (this adds an integral term but no proportional term): num = [10]; den = [1.25, 1]; numPI = [1]; denPI = [1 0]; newnum = conv(num,numPI); newden = conv(den,denPI); bode(newnum, newden, logspace(0,2)) (ii) Study the Bode plot and record the phase margin and gain cross over frequency in Table 1 (row 2). (iii) Plot the step response by adding the following two lines to your m-file: [clnum,clden] = cloop(newnum,newden,-1); step(clnum,clden) (iv) Study the step response plot and record the steady-state error and settling time in Table 1 (row 2). You may change both the x-axis and y-axis limits for better view. 4.3 System with proportional-integral controller (i) In order to improve phase margin, we add a zero at s = -1. Thus we now have a PI K (s + a) controller with the following form of transfer function GC ( s ) = . Change your ms file to the following: num = [10]; den = [1.25, 1]; numPI = [1 1]; denPI = [1 0]; newnum = conv(num,numPI); newden = conv(den,denPI); bode(newnum, newden, logspace(0,2)) (ii) Obtain the step response plot as well. Study the Bode plot and step response plot. Record the results in Table 1 (row 3). (iii) Try to obtain a higher bandwidth frequency without changing the phase margin too much. This can be achieved by increasing the gain. This will change the gain but the phase will remain the same. By trial and error, change a few gain values and study the Bode plot and step response plot. Record the relevant information in Table 1.

Table 1 Steadystate error 4.1 4.2 4.3 Original system With integral controller Adding a zero Changing the gain G1 = value. Record G2 = additional gain G3 = (not inclusive of original gain). 9% Settling time (s) 0.45s Phase margin (degrees) Gain cross over frequency (rad/s)

5. Exercises
1. Perform a block diagram reduction to obtain a single transfer function for the system with PI control. 2. Why is the bandwidth an important parameter in the analysis of control systems? 3. Explain why adding a zero can improve the phase margin. 4. Explain why a large phase margin is preferred in a control system. 5. How is time domain performance of a control system related to its frequency domain performance?

6. Discussion
In this lab, you have learned how to analyze the frequency response of a system using Bode plot. In particular, you have seen how to obtain the gain margin and phase margin from the Bode plot. You have also learnt how to design a suitable controller to meet frequency domain and time domain performance criteria. In general, we would like to have large gain margin and phase margin, to ensure that the closed loop system is more stable in the presence of noise (from the environment and from the sensors). In addition to this, we prefer a design with small settling time and no steady-state error.

7. Further Information Regarding this Laboratory


1. There will be an on-the-spot assessment. Marks will be given based on the work done such as your graphs (shown on the screen) and tabulated results, as well as your understanding of the related theories. There is no need to print your graphs. 2. There is no laboratory report required for this experiment. There will be a separate lab design project. Please check any announcement on MMLS regarding this. 3. If you wish to save your graph, you can click File Save and save it as a .fig file. If you wish to export it into Word, then you should click File Export and save it as a .emf file. You can insert this graph from Word by clicking Insert Picture From File and then selecting the filename.

Lab Assessment:

On-Spot evaluation (40%). Experiment results & Lab report (60%).

10

You might also like