Frequency Response: From Poles and Zeros to Stability and Compensation
- 2 views
- Last updated
- Engineering
A frequency response lecture for controls students who already know what feedback does. We drive a plant with sine waves and read off the amplitude ratio and the phase shift, then build the magnitude and phase curves factor by factor out of a constant gain, an integrator, a pole and a zero, so the straight line approximations become arithmetic rather than folklore. We assemble a full third order loop segment by segment, locate its gain and phase crossover frequencies, close the loop, and show why the frequency at which the phase reaches minus one hundred and eighty degrees decides stability. Gain margin and phase margin are defined on those curves, and the loop is then driven into sustained and then growing oscillation by raising the gain past its margin. The lecture closes with a lag and then a lead compensator, comparing what each one does to both curves.
You already know what a feedback controller does. This lecture is about a different question, and it is the question most of classical control is actually built on. Not what a plant does to a step, but what it does to a sine wave, one frequency at a time. Answer that for every frequency and you have said everything there is to say about a linear system. So here is the setup. Take a plant that is linear and time invariant, and drive it with a pure sine wave. Because it is linear, whatever comes out is also a sine wave, at exactly the same frequency. Nothing else is possible, so only two things can differ between what goes in and what comes out: the size, and the timing. Let me make that concrete with the simplest plant there is, a single lag, one over s plus one. Drive it slowly, at a fifth of a radian per second. The grey curve is what we push in, the blue curve is what comes back out, and time runs along the bottom in seconds. Honestly, the two waves are almost the same wave. The output stands ninety eight percent as tall as the input, and it trails behind it by about eleven degrees. At this frequency the plant is barely doing anything at all. Ask it to move slowly, and it simply follows. One thing I am quietly assuming here. These are steady state pictures. Switch the drive on and there is a transient while the plant settles. Frequency response is what is left after that transient has died away. Now speed the drive up to one radian per second. Same plant, same amplitude going in. The output has dropped to seventy one percent of it, and it is now a full forty five degrees behind. That is an eighth of a cycle of lag. And at five radians per second the plant has more or less given up. The output is only two tenths of the input amplitude now, and it lags by seventy nine degrees, closing in on ninety. Notice the pattern that is forming. As the frequency climbs, the output shrinks, and it falls further and further behind. Both of those numbers come out of one piece of algebra, and you have seen it before. Put s equal to j omega in the transfer function. What comes back, for each frequency, is a single complex number. Its magnitude is the amplitude ratio: how much taller or shorter the output is than the input. Its argument is the phase shift, in degrees, and it is negative when the output lags. Two real numbers per frequency, and that pair is the whole of the frequency response. One convention before we plot any of it. We do not plot the magnitude directly. We plot twenty times its logarithm, in decibels. The reason is pure arithmetic. A transfer function is a product of factors, and taking logarithms turns that product into a sum of curves you can add up by eye. And the frequency axis is logarithmic as well. Every unit along it is one decade, a factor of ten in frequency. So the axis we are about to use runs from a tenth of a radian per second on the left to a hundred on the right, in three even steps. So here is the magnitude of that single lag, in decibels, against the logarithm of frequency. And here are the three experiments we just ran, sitting on it as three green dots: a fifth, one, and five. Flat and unbothered on the left, where the plant follows whatever it is given. Falling away steadily on the right, where it cannot keep up. The table beside it is those same three readings written out. Underneath goes the phase, in degrees, on the same frequency axis. Zero at low frequency, minus ninety at high frequency, and passing through minus forty five right at one radian per second, which is exactly where the pole is. Now look hard at what those two curves nearly are. The magnitude is nearly two straight lines: flat, then falling at twenty decibels per decade, and they meet at the pole. The phase is nearly three straight lines, hinged a decade either side of it. That is not a coincidence and it is not a drawing trick. It falls out of the algebra, and in the next part we work out exactly where it comes from, factor by factor, until sketching one of these is arithmetic. Then we close the loop. And I will show you why one particular frequency, the one where the phase reaches minus one hundred and eighty degrees, decides whether the closed loop is stable at all. Gain margin and phase margin are the two numbers that live at that frequency, and by the end you will read both of them straight off these curves.
So why decibels, and why a logarithmic frequency axis. Here is the answer, and it is the only reason those two conventions exist. A transfer function is a product: a constant out front, some factors upstairs, some factors downstairs. Take twenty times the logarithm of the magnitude, and that product becomes a sum. Every factor on top adds its own decibel curve. Every factor on the bottom subtracts one. Nothing else happens. And the angle of a product is the sum of the angles anyway, so the phase adds in exactly the same pattern, with no logarithm needed. Two sums, one for each curve. So if I can draw four simple curves, I can draw any Bode plot by stacking them up. Let me take those four one at a time. The first one is trivial. A constant gain K. Its magnitude does not depend on frequency at all, so in decibels it is a horizontal line at twenty log K. With K equal to two, that sits at six decibels. And a positive real number has no angle, so it contributes nothing whatsoever to the phase. The second one is an integrator, one over j omega. Its magnitude is one over omega, so in decibels it is minus twenty times the logarithm of omega. That is a straight line, exactly, at every frequency. And you can read the slope off it by arithmetic. At one radian per second it is zero decibels. At ten, it is minus twenty. At a hundred, minus forty. Every decade costs twenty decibels, forever. Its phase is easier still. One over j is minus j, which points straight down. Minus ninety degrees, at every frequency, with no bend in it anywhere. The third block is the one that actually earns its keep: a real pole, written so that it equals one at zero frequency. One over one plus j omega over omega p. Take it to its two limits and everything falls out. Well below the corner, omega over omega p is tiny, so the denominator is essentially one. The factor is one. Zero decibels, and no phase. That is the flat piece. Well above the corner, the one is negligible and the factor is omega p over j omega. That is an integrator again, scaled. So it falls at twenty decibels per decade, and its phase is minus ninety. So we have a flat line at zero on the left, a falling line at minus twenty on the right, and they cross where omega equals omega p, which here is two radians per second. That crossing is what everybody calls the corner, or the break frequency. Now, how wrong is that sketch. Right at the corner the denominator is one plus j, whose magnitude is root two, and twenty log of root two is minus three decibels. Three decibels below the corner of the sketch, and that is the worst it ever gets. Half a decade either side of the corner the error is down to one decibel, and a decade out it is under a quarter of one. So the straight lines are not a cartoon. They are the truth to within three decibels, everywhere. The phase needs one more rule, and it is a convention rather than a theorem. Zero below a decade under the corner, minus ninety above a decade over it, and a straight ramp of minus forty five degrees per decade joining them. At the corner itself the ramp is halfway down, at minus forty five degrees, and that one is exact: one over one plus j has an angle of minus forty five, precisely. The worst error in the ramp is about six degrees, out near its two hinges. And the fourth block is the same numbers with every sign flipped, because a zero is a pole moved upstairs. Flat, then rising at twenty decibels per decade. Zero degrees, then a ramp up to plus ninety. That is the whole vocabulary. Four shapes, and a Bode plot is what you get when you add up however many of them your plant happens to have. Written out as a table, that is it. A gain moves the whole magnitude curve up or down and touches nothing else. An integrator tilts it by twenty decibels per decade and drops the phase by ninety, at every frequency. A zero puts a bend upward in the magnitude at its own frequency, and hands you ninety degrees of phase lead spread across two decades. A pole does the mirror image: a bend downward, and ninety degrees of lag. And the two error facts are worth memorising, because they are the whole difference between the sketch and the truth. Three decibels at each corner, and a decade either side for the phase. Nothing else is approximate. So the straight lines are not magic. They are two limits and a hinge. Now let me stack them, on a plant with a pole, another pole, and an integrator in it.
Here is the plant we will carry for the rest of the lecture. Forty, over s times s plus two times s plus ten. Third order, one integrator, two real poles, and nothing exotic anywhere in it. Before we can stack anything we have to rewrite it, because our four building blocks all equal one at low frequency and these brackets do not. So pull a two out of the first bracket, and a ten out of the second. Forty over twenty leaves two, and now every factor is in the right shape. Read them off. A gain of two, worth six decibels. One integrator. A pole at two radians per second, and a pole at ten. Those four items are the entire plant, and they are the entire Bode plot. So let us draw it. I will lay the magnitude down first, one segment at a time, and check a number at every break. Start at the far left of the magnitude plot, at a tenth of a radian per second. Down there both poles are still asleep, because we are well below both corners. So only the gain and the integrator are doing anything at all. Six decibels from the gain. And the integrator is worth plus twenty down there, because it costs twenty per decade and we are one decade below one radian per second. Six plus twenty is twenty six, and from there the line comes down at twenty decibels per decade. That segment runs until the first pole wakes up, at omega equal to two. Where has the line got to by then? Six from the gain, minus twenty log of two, which is another six. It arrives at exactly zero decibels. And past that corner the pole adds its own twenty per decade on top of the integrator's. So the slope steepens to minus forty, and the second segment falls twice as fast as the first. It runs from two up to ten, which is log ten of five, about seven tenths of a decade. At forty decibels a decade, that is twenty eight decibels lost, so we reach the second corner at minus twenty eight. Beyond ten the second pole joins in as well, so the slope steepens again, to minus sixty decibels per decade, and it never comes back up. Three segments, three slopes, and every number in them was arithmetic. Now here is the exact curve, drawn over the top. It hugs the skeleton everywhere, except that it rounds each corner off and sits about three decibels below it, exactly as we worked out. The phase is built the same way, and it starts lower down. The integrator hands us minus ninety degrees at every frequency, so the phase begins at minus ninety on the left and does not move until the first ramp starts. The pole at two begins bending a decade below itself, at nought point two, and finishes a decade above, at twenty. So this second piece falls at forty five degrees per decade. But at one radian per second the pole at ten begins its own ramp, and now both are running together. Two ramps at forty five each make ninety degrees per decade, so this middle piece is the steepest part of the whole curve. The first ramp finishes at twenty, and after that only the second is left, so we go back to forty five per decade and settle at minus two hundred and seventy. Ninety from the integrator, and ninety from each pole. And there is the exact phase over the top of that, never more than a few degrees from the hinges. Two curves, built out of nothing but four factors and a ruler. Two frequencies on these curves matter more than all the others, and the rest of the lecture is about them. The first is where the phase passes through minus one hundred and eighty degrees. You can find it exactly. Set the phase equal to minus one eighty. The integrator has already spent the ninety, so the two arctangents have to add up to ninety degrees between them. Two angles summing to ninety means their tangents multiply to one, and running that through the addition formula leaves one minus omega squared over twenty equal to zero. So the phase crosses minus one eighty at the square root of twenty, about four point four seven radians per second. Call it the phase crossover frequency. There it is on the curve. The second frequency is where the magnitude passes through zero decibels, where the loop neither amplifies nor attenuates. The skeleton puts that at two radians per second, where its two segments straddle the axis. The exact curve crosses lower, at about one point five six, and the gap is the three decibel corner error we already know about. Call that one the gain crossover frequency, and take the exact value, because we are about to measure a stability margin with it. Two frequencies, both read off curves we built by hand. Now let us close the loop and find out what they are worth.
Close the loop around that plant with unity negative feedback, and the closed loop transfer function is L over one plus L. Everything about stability is hiding in that denominator. The loop is on the edge of trouble when the denominator vanishes at some real frequency. That is one plus L of j omega equal to zero, which is L of j omega equal to minus one. Now read minus one in polar form, because that is what a Bode plot shows you. Its magnitude is one, and its angle is minus one hundred and eighty degrees. Two conditions, and they have to hold at the same frequency. Let me show you what that actually means physically, because the algebra hides it. Break the loop, and inject a sine wave at the phase crossover frequency, four point four seven radians per second. That is the grey wave. Send it round the plant. What comes back is the blue wave. It is one sixth the size, because we measured that magnitude, and it is upside down, because the phase there is minus one eighty. Half a cycle of delay is exactly an inversion. And now the summing junction does its job. Negative feedback subtracts, which flips that wave over one more time. So what actually gets added back in is the green wave, and look where it sits. It is in phase with what we injected. Perfectly, exactly in phase. That is the whole danger of this frequency. Everywhere else the returning signal partly cancels what is already there. Here it reinforces it. The only thing saving us is the size. It comes back one sixth as tall, so each trip round the loop it shrinks, and the ringing dies away. But suppose we multiplied the gain by six. Then it would come back exactly the same size it went in. And there it is, landing precisely on top of the wave we injected. At that point the loop no longer needs us. It can sustain that oscillation with no input at all, forever. So the factor six is a real quantity, and it has a name. It is the gain margin: how much you may multiply the loop gain by before the returning wave comes back full size. You read it off the plots in two steps. Find the frequency where the phase curve crosses minus one eighty. Drop straight up to the magnitude curve. Whatever gap you find between there and zero decibels is the gain margin. Here that gap measures fifteen point six decibels. And fifteen point six decibels is a factor of six, which is exactly the number we found by hand a moment ago. The other margin runs the same procedure the other way round. Start on the magnitude curve, at the frequency where it crosses zero decibels, one point five six. Drop down to the phase curve there. The phase reads minus one hundred and thirty seven degrees. So we are forty three degrees short of minus one eighty, and that is the phase margin: how much extra lag you could pour into this loop before it sang. And that second one is usually the number engineers care about more, because extra lag arrives whether you asked for it or not. A transport delay, a filter you forgot, an actuator that is slower than the model says. All of it eats phase margin, and none of it touches gain margin. Forty three degrees and a factor of six. Now let me spend them. First, what a gain change does to these two curves, because it is the simplest thing in the subject. Multiplying by a constant adds a constant number of decibels at every frequency, so the magnitude curve moves bodily upward. Its shape does not change at all. And a positive constant has no angle, so the phase curve does not move by one degree. Watch it. It will sit perfectly still through everything that follows, which is why the phase crossover frequency never moves either. Now lift the gain by our whole margin, a factor of six, fifteen point six decibels. Up goes the magnitude curve, and it keeps its shape exactly. And look what has happened at the phase crossover. The point that was fifteen point six decibels down is now sitting exactly on zero. The gain crossover and the phase crossover have arrived at the same frequency. Both conditions for minus one now hold together, and here is what that does in the time domain. This is the closed loop answering a step, at the original gain of forty. Some overshoot, a couple of swings, settled inside five seconds. And this is the same loop with the gain multiplied by six, at two hundred and forty. It never settles. It never diverges either. It just rings, with the same amplitude, indefinitely. Measure the period of that ringing. It is one point four seconds, and two pi over four point four seven is one point four. The loop is oscillating at precisely the frequency we identified on the phase plot, using nothing but arctangents. Push a little further, to two hundred and eighty, which is past the margin, and the oscillation grows instead of holding. The closed loop poles have crossed into the right half plane, and the frequency response of the open loop told us the exact moment it would happen. So the margins are not bookkeeping. They are the distance, measured in decibels and in degrees, between the loop you have and a loop that sings on its own. What is left is to buy some of that distance back.
Everything so far has been diagnosis. We took a plant apart, drew its two curves, and read two margins off them. Now let us change those curves on purpose, with the two simplest tools there are. Both of them are one zero and one pole. That is all. And the only thing that distinguishes them is which of the two sits at the lower frequency. Put the pole first, below the zero, and you have a lag compensator. At zero frequency the two brackets are both one, so it does nothing. Above the zero, the denominator has grown more than the numerator, so it attenuates. Put the zero first instead, below the pole, and you have a lead compensator. Again it is worth one at zero frequency, but now above the pole the numerator has won, so it amplifies. And in between it hands you phase lead, which is the thing you actually wanted. So one of them cuts the high end and one of them lifts it. Let us watch what each does to a loop we already know. Here is our plant again, in blue, on both plots. I have widened the frequency axis down to a hundredth of a radian per second, two decades lower than before, because that is where a lag compensator lives. Now the lag section on its own, in yellow. Its pole is at a hundred and twenty five ten thousandths, its zero at five hundredths. So it starts flat at zero decibels, falls at twenty per decade between the two, and then goes flat again. How far does it fall? The ratio of the pole to the zero, a quarter, which is twelve decibels. That is the whole of what this section is for: a twelve decibel cut, delivered at every frequency above five hundredths. And here is its phase. It dips down about thirty degrees in the middle, and comes back to zero afterwards. That dip is the price you pay, and look where it is: two decades below anything we care about. By the time we reach the interesting frequencies the section has given all of it back. Add the yellow to the blue, and the green curves are the compensated loop. Identical to the plant at low frequency, twelve decibels below it everywhere else. So the magnitude curve has dropped, and the point where it crosses zero decibels has slid a long way to the left. From one point five six down to about nought point four nine. And that is the whole trick. Down at nought point four nine, the plant had barely started lagging. The phase there is about minus one hundred and eleven degrees, so the phase margin is sixty nine, up from forty three. The gain margin improves too, from six to twenty four, because the whole magnitude curve dropped and the phase crossover frequency hardly moved. But notice what it cost. The crossover frequency is the loop's bandwidth, and we just divided it by three. This loop is safer and it is slower. Now clear those away and try the other one. The lead has its zero at one point two and its pole at seven point two, so both of them sit right in the middle of the action, near the old crossover. In yellow again, its magnitude is flat, then rises at twenty decibels per decade between the zero and the pole, then flat again. The ratio of zero to pole is one sixth, so it lifts the high end by about sixteen decibels. And here is the part we actually came for. Its phase rises to a maximum partway up, and for a ratio of one sixth that maximum is forty six degrees. It happens at the geometric mean of the zero and the pole, which is two point nine four. So you place the compensator so that its phase peak lands where the loop is going to cross zero decibels. Add the two together, and here are the compensated curves. The magnitude has been lifted at the top end, so crossover moves the other way this time, up from one point five six to two point six five. And on an uncompensated plant that would be bad news, because the phase up there is worse. But the lead has bumped the phase up by forty five degrees at exactly that frequency. So instead of the minus one hundred and fifty eight the plant would have given us, we read minus one hundred and twelve, and the phase margin is sixty eight. The gain margin is essentially unchanged, about sixteen decibels, because the lead pushed the phase crossover frequency out and lifted the magnitude there by about the same amount. Both effects roughly cancel. So look at what we bought. The same phase margin the lag gave us, near enough, but with the crossover frequency up rather than down. This loop is safer and it is faster. Side by side, then. The lag cuts the high end of the magnitude curve. The lead lifts it, and that single difference drives everything else about the two of them. The lag's own phase contribution is a nuisance to be parked out of the way, two decades below the action. The lead's phase contribution is the entire point, and you place it deliberately on top of the crossover frequency. So the lag moves the crossover down and the lead moves it up. Both of them end up buying you phase margin, and they buy it in opposite currencies: one pays with speed, the other pays with amplified high frequency, which means amplified noise. And both are one zero and one pole, the same two curves we drew by hand earlier. Which one you put first is the whole difference between them. That is the arc. A sine wave in gives a sine wave out, and two numbers record it. Those two numbers, plotted against a logarithmic frequency axis, are sums of straight lines you can draw from the poles and zeros alone. Close the loop, and one frequency on those plots decides everything: the one where the phase reaches minus one hundred and eighty degrees, where the returning signal comes back in step with itself. How far the magnitude sits below unity there is your gain margin, and how far the phase sits above minus one eighty at unity gain is your phase margin.
Loading discussion…