matlab13

6
Matlab tutorial Part 3 ROOT LOCUS ME 461 Professor Tilbury Note: These tutorials have been completely revised and updated. See Control Tutorials for Matlab for the latest version. Remember that the root locus of an (open-loop) transfer function H(s) is the locus of all possible locations of the closed loop poles with proportional gain k and unity feedback: r e _____ u __________ y --->O--->| k |---->| H(s) |--+---> | |___| |________| | | | +--------------------------+ The closed-loop transfer function is Y(s) k H(s) ---- = ----------- R(s) 1 + k H(s) and thus the poles of the closed loop system are values of s such that 1 + k H(s) = 0. If we write H(s) = b(s)/a(s), then this equation has the form: a(s) + k b(s) = 0 a(s) ---- + b(s) = 0. k Let n = order of a(s) and m = order of b(s) [the order of a polynomial is the highest power of s that appears in it]. We will consider all positive values of k. In the limit as k -> 0, the poles of the closed-loop system are a(s) = 0 or the poles of H(s). In the limit as k -> infinity, the poles of the closed-loop system are b(s) = 0 or the zeros of H(s). No matter what we pick k to be, the closed-loop system must always have n poles, where n is the number of poles of H(s). The root locus must have n branches, each branch starts at a pole of H(s) and goes to a zero of H(s). If H(s) has more poles than zeros (as is often the case), m < n and we say that H(s) has zeros at infinity. In this case, the limit of H(s) as s -> infinity is zero. The number of zeros at infinity is n-m, the number of poles minus the number of zeros, and is the number of branches of the root locus that go to infinity (asymptotes). Consider a widget which has a transfer function of Y(s) 1 gina 1 de 6 Matlab tutorial - 3 19/11/2004 http://www.personal.engin.umich.edu/~tilbury/tutorials/matlab3.html

Upload: robert-roig

Post on 21-Jul-2016

213 views

Category:

Documents


1 download

TRANSCRIPT

Matlab tutorial Part 3 ROOT LOCUS

ME 461 Professor Tilbury

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

Remember that the root locus of an (open-loop) transfer function H(s) is the locus of all possible locations of the closed loop poles with proportional gain k and unity feedback:

r e _____ u __________ y --->O--->| k |---->| H(s) |--+---> | |___| |________| | | | +--------------------------+

The closed-loop transfer function is

Y(s) k H(s) ---- = ----------- R(s) 1 + k H(s)

and thus the poles of the closed loop system are values of s such that 1 + k H(s) = 0.

If we write H(s) = b(s)/a(s), then this equation has the form:

a(s) + k b(s) = 0 a(s) ---- + b(s) = 0. k

Let n = order of a(s) and m = order of b(s) [the order of a polynomial is the highest power of s that appears in it].

We will consider all positive values of k. In the limit as k -> 0, the poles of the closed-loop system are a(s) = 0 or the poles of H(s). In the limit as k -> infinity, the poles of the closed-loop system are b(s) = 0 or the zeros of H(s).

No matter what we pick k to be, the closed-loop system must always have n poles, where n is the number of poles of H(s). The root locus must have n branches, each branch starts at a pole of H(s) and goes to a zero of H(s). If H(s) has more poles than zeros (as is often the case), m < n and we say that H(s) has zeros at infinity. In this case, the limit of H(s) as s -> infinity is zero. The number of zeros at infinity is n-m, the number of poles minus the number of zeros, and is the number of branches of the root locus that go to infinity (asymptotes).

Consider a widget which has a transfer function of

Y(s) 1

Página 1 de 6Matlab tutorial - 3

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

H(s) = ------ = ----------------- U(s) s (s^2 + s + 4)

Make a matlab file called rl.m. Enter the transfer function of the widget, and the command to plot the root locus:

numH = 1; denH = [1 1 4 0]; rlocus(numH,denH)

This plot shows all possible closed-loop pole locations for a pure proportional controller. Try to find the value of k for which the locus crosses the jw-axis (the point at which the system becomes unstable). Type in the matlab window:

[k,poles] = rlocfind(numH,denH)

and then click on the crossing point in the graphics window. Matlab will return to you the locations of all three poles as well as the value of k. Try this for a few different points on the locus.

Let's say you decide to try a pure proportional controller, and use the Ziegler-Nichols tuning to pick the proportional gain to be 1/2 the gain at instability. Do an rlocfind again to save the value of k when the root locus crosses the imaginary axis (call it ku). In order to find the step response, you need to know the closed-loop transfer function. You could compute this using the rules of block diagrams, or let matlab do it for you:

[numCL, denCL] = cloop((ku/2)*numH, denH)

The two arguments to the function cloop are the numerator and denominator of the open-loop system. You need to include the proportional gain that you have chosen. Unity feedback is assumed.

If you have a non-unity feedback situation, look at the help file for the matlab function feedback, which can find the closed-loop transfer function with a gain in the feedback loop.

Check out the step response of your closed-loop system:

step(numCL,denCL)

Página 2 de 6Matlab tutorial - 3

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

Boy, the transient sure takes a long time to settle. That's becuase the closed-loop poles are so close to the jw-axis (sigma is small). Adding a zero to the system can increase the damping and pull the root locus farther to the left-half plane. Let's try a PD controller,

K(s) = Kp + s Kd

Since we can only plot the root locus with respect to one parameter at a time, let's choose Kp = 2 and plot the locus with respect to Kd. Here we will need to do a little algebraic manipulation before we start. The characteristic polynomial of the closed-loop system is:

1 + K(s) H(s) = 0 (2 + s Kd) 1 + ---------------- = 0 s (s^2 + s + 4) s^3 + s^2 + 4s + 2 + Kd s = 0 s Kd 1 + ------------------ = 0 s^3 + s^2 + 4s + 2

Note that a pure derivative term (if Kp were equal to zero) just adds a zero at the origin (a pure integral term adds a pole at the origin). The denominator now has an extra term due to Kp. To find the root locus of this system,

numD = [1 0]; denD = [1 1 4 2]; rlocus(numD,denD)

Página 3 de 6Matlab tutorial - 3

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

Well, at least the system is stable for all values of Kd. Try to pick a point on the root locus with as large a damping coefficient (zeta) as possible,

[kd,poles] = rlocfind(numD,denD)

and find the step response (the open-loop transfer function is K(s) H(s)):

numOL = [kd 2]; denOL = [1 1 4 0]; [numCL,denCL] = cloop(numOL,denOL); step(numCL,denCL)

The settling time is still pretty long, and see how the addition of the zero has increased the magnitude of the oscillations.

Now try a lead controller,

s + 2 K(s) = k --------- s + 10

You could multiply out the numerator and denominator polynomials to find K(s) H(s), or you could let matlab do the work. Although matlab can't deal with symbolic expressions (like s), two

Página 4 de 6Matlab tutorial - 3

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

polynomials are multiplied by taking the convolution of their coefficients (remember convolution?)

numK = [1 2]; denK = [1 10]; numL = conv(numK,numH); denL = conv(denK,denH);

Now find the root locus with respect to the parameter k in your lead controller:

rlocus(numL,denL)

If you always add a compensator which has the same number of zeros as poles (a good idea in practice), the closed-loop system will always have three zeros at infinity, or three asymptotes, which go off at angles of 120 degrees to each other. If two of them start from the poles near the jw-axis, they will become unstable quickly. One way to deal with those two poles is to add zeros near them in a configuration called a notch filter (see p. 309 of your book for more details)

s^2 + s + 3.5 K(s) = k ---------------- (s + 10)^2

Plot the root locus of this controller with respect to the gain k.

There are still three asymptotes, but the closed-loop system is stable for many more values of the gain k. Now you can actually choose the dominant poles to have a damping coefficient (zeta) of 0.707 (a 45 degree angle). Use rlocfind to get the gain k at those poles, and plot the step response of the compensated system. I get a response that looks something like:

Página 5 de 6Matlab tutorial - 3

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

Do you think the WACKO marketers will be happy with it? Can you do better???

ME 461 Home Page

Matlab tutorial Part 4

Last modified: 5 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 6 de 6Matlab tutorial - 3

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