matlab14

10
Matlab tutorial Part 4 Frequency Domain Analysis and Design ME 461 Professor Tilbury Note: These tutorials have been completely revised and updated. See Control Tutorials for Matlab for the latest version. Pretty much any type of analysis or design that can be done using root-locus methods can also be done using frequency-domain methods. Frequency domain methods, however, can also be used in situations when the exact transfer function is not known. The frequency response of a system can be measured in the laboratory by choosing different sinusoidal inputs and measuring the magnitude and phase of the sinusoidal output, or by using a special type of instrument. If a system has a transfer function G(s), its frequency response is G(jw) (it is only evaluated for values of s which are on the jw axis). Since G(jw) is a complex number, it is usually represented in two different plots, one for its magnitude and the other for its phase, both as functions of w. These two plots together are called the Bode plot of the system. By using a log scale for the frequency and the magnitude, and a linear scale for the phase, the composition of two systems (in series) is easily accomplished by adding together their Bode plots. For example, consider a standard second-order system (mass-spring-damper): 1 G1(s) = ------------- s^2 + s/2 + 1 and find its Bode plot using matlab: numG1 = 1; denG1 = [1 0.5 1]; bode(numG1,denG1); gina 1 de 10 Matlab tutorial - 4 19/11/2004 http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

Upload: robert-roig

Post on 21-Jul-2016

1 views

Category:

Documents


0 download

TRANSCRIPT

Matlab tutorial Part 4 Frequency Domain Analysis and Design

ME 461 Professor Tilbury

Note: These tutorials have been completely revised and updated. See Control Tutorials for Matlab for the latest version.

Pretty much any type of analysis or design that can be done using root-locus methods can also be done using frequency-domain methods. Frequency domain methods, however, can also be used in situations when the exact transfer function is not known. The frequency response of a system can be measured in the laboratory by choosing different sinusoidal inputs and measuring the magnitude and phase of the sinusoidal output, or by using a special type of instrument.

If a system has a transfer function G(s), its frequency response is G(jw) (it is only evaluated for values of s which are on the jw axis). Since G(jw) is a complex number, it is usually represented in two different plots, one for its magnitude and the other for its phase, both as functions of w. These two plots together are called the Bode plot of the system. By using a log scale for the frequency and the magnitude, and a linear scale for the phase, the composition of two systems (in series) is easily accomplished by adding together their Bode plots. For example, consider a standard second-order system (mass-spring-damper):

1 G1(s) = ------------- s^2 + s/2 + 1

and find its Bode plot using matlab:

numG1 = 1; denG1 = [1 0.5 1]; bode(numG1,denG1);

Página 1 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

Now add an integrator (a pole at the origin)

G2(s) = 1/s numG2 = 1; denG2 = [1 0]; bode(numG2,denG2);

Página 2 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

The combined system has a transfer function given by:

G(s) = G1(s) G2(s) [numG,denG] = series(numG1,denG1,numG2,denG2); bode(numG,denG); subplot(2,1,1); axis([0.1 10 -60 20]);

Página 3 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

which is the sum of the two individual Bode plots. Note the subplot and axis commands which change the scale on the magnitude plot only.

There are several characteristics of a system that you can read directly from its Bode plot:

Bandwidth. Sinusoidal inputs with frequency less than w_BW are tracked "reasonably well" by the system. Sinusoidal inputs with frequency greater than w_BW are attenuated by a factor of 0.707 or greater. Locate the point 0.7 on the magnitude axis (or -3dB), and draw a line across until it hits the plot of |G(s)|. Read down to find w_BW, as shown in the figure:

[m,p,w]=bode(numG1,denG1); loglog(w,m); axis([0.1 10 0.01 10]); grid;

Página 4 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

You can find the output of a system to a sinusoidal input by using the lsim command in matlab:

t=0:0.1:50; u = sin(0.3*t); [y,x] = lsim(numG1,denG1,u,t); plot(t,y,t,u)

Página 5 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

t=0:0.1:10; u = sin(3*t); [y,x] = lsim(numG1,denG1,u,t); plot(t,y,t,u)

Note the phase lag as well as the magnitude attenuation in the second plot.

Questions:

1. What is the bandwith of G2? of G? 2. For u(t) = 10 sin(t), what is the (steady-state) output of G1 (magnitude and phase)? 3. For u(t) = 10 sin(10 t), what is the (steady-state) output of G2?

Check your answers using lsim.

System Type. The system type is the number of (open-loop) poles at s=0, and is the (negative of the) slope of the low-frequency portion of the magnitude Bode plot. By Bode's gain-phase relationship:

<G(jw) = n x 90 (n is the slope of |G(jw)|)

the type is also the same as the phase of G(jw) for low frequencies divided by 90 degrees. With unity feedback, a Type 1 system has zero steady-state error to a step input and a Type 2 system has zero steady-state error to a ramp input.

Questions:

1. What is the type of G1? G2? G?

Steady-state error. The value of the intersection of the low-frequency asymptote with the w=1 line is the constant Ko of the Bode normal form.

Página 6 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

Remember the table which gives steady-state errors as a function of system type (under unity feedback):

step ramp t^2 ----------------------------------------------------- 1 type 0 -------- inf. inf. 1 + K0 ----------------------------------------------------- 1 type I 0 ---- inf. K0 ----------------------------------------------------- 1 type II 0 0 ---- K0 -----------------------------------------------------

Also remember that adding a proportional gain to the system will change only the magnitude portion of the Bode plot (and hence the steady-state error).

Questions (assume unity feedback in all cases):

1. What is the steady-state error of the system G(s) to a unit step input? 2. What is the steady-state error of the system G(s) to a unit ramp input u(t) = t (t > 0) ? 3. What is the steady-state error of the system G1(s) with proportional gain K = 10 to a unit step

input?

Check your answers using step or lsim.

Roll-off rate. The roll-off rate is the rate at which the magnitude of the transfer function "rolls off"

Página 7 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

for high frequencies. It is the slope of the |G(jw)| curve for large w. Because each pole contributes -1 to the slope and each zero contributes +1, we have

roll-off rate = n-m = number of poles - number of zeros = number of zeros at infinity.

By Bode's gain-phase relationship, the roll-off rate can also be read off the phase plot as the phase at high frequencies divided by 90 degrees.

Questions:

1. What is the roll-off rate of G1? G2? G?

Gain margin. The closed-loop system is marginally stable when the root-locus crosses the jw axis, or 1 + KG(jw) = 0. In terms of magnitude and phase, |KG(jw)| = 1 and <KG(jw) = -180. Since most systems become unstable as K increases, the gain margin is defined as how much the proportional gain K can increase (in a unity feedback situation) before instability results. This can be read directly from the Bode plot by finding the point when the phase crosses 180 degrees, and finding the magnitude at that frequency:

If the gain is greater than 1 (0dB) then the system is unstable at K=1, and the gain margin is negative (dB) or < 1 (magnitude). If the phase never crosses 180, then the system is stable for all gains and the gain margin is infinite.

Phase margin. The analog of the gain margin is the phase margin. This is found from the Bode plot as the difference from the phase from 180 when the magnitude is equal to 1 (or 0dB).

Página 8 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

If the phase is less than -180 when the magnitude is equal to one, then the closed-loop system is unstable for K=1. The phase margin for different proportional gains K can also be found from the Bode plot. When the system |KG(jw)| crosses magnitude 1, then |G(jw)| crosses magnitude 1/K. Shown above is the calculation for K = 1/3 (20 log (1/K) = 9.5 dB).

The phase margin is related to the damping of the closed-loop system by the equation:

zeta PM ~= ------ 100

This is a reasonably good approximation for PM < 70 (zeta < 0.7).

Questions:

1. Find the phase margin and gain margin of G1(jw).

Design Problems: For all problems, use unity feedback and proportional control only. You should be able to find K just from looking at the Bode plots.

1. You want system G1 to track a step input with a steady state error of less than 1/100. What is the damping of the closed-loop system? Plot the step response.

2. You want system G to track a ramp input with steady-state error less than 1/10. What is the damping? Plot the output to a unit ramp (u(t) = t).

3. You want system G to track a step input with maximum overshoot less than 10%. Use the chart in your book to find zeta. Plot the step response to verify your design.

Back to ME461 Home Page

Página 9 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html

Matlab tutorial Part 5

Last modified: 19 march 1995 / [email protected]

Please send any comments, clarifications, suggestions, or corrections to: [email protected]. Thanks! I hope you found this document helpful.

Página 10 de 10Matlab tutorial - 4

19/11/2004http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab4.html