{"version":1,"lectureId":"01M14TY867AYWPKBBRWT86KP3M","attempt":0,"publication":{"slug":"frequency-response-bode-closed-loop","title":"Frequency Response: From Poles and Zeros to Stability and Compensation","subject":"engineering","summary":"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.","metaDescription":"Build Bode magnitude and phase curves from poles and zeros, define gain and phase margin, then see what lag and lead compensators change.","transcript":"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.","watch":{"version":1,"scenes":[{"title":"Sine In, Sine Out","start":0,"end":301.1635000000001,"objects":{"angle_high":"a PlotPoint [green] drawn in phase_axes (target='phase_curve', x=0.6989700043360189)","angle_low":"a PlotPoint [green] drawn in phase_axes (target='phase_curve', x=-0.6989700043360187)","angle_mid":"a PlotPoint [green] drawn in phase_axes (target='phase_curve')","cap_high_bottom":"a Math [text] that says \"$|G| = 0.20, thin -79 degree$\"","cap_high_top":"a Math [text] that says \"$omega = 5$\"","cap_low_bottom":"a Math [text] that says \"$|G| = 0.98, thin -11 degree$\"","cap_low_top":"a Math [text] that says \"$omega = 0.2$\"","cap_mid_bottom":"a Math [text] that says \"$|G| = 0.71, thin -45 degree$\"","cap_mid_top":"a Math [text] that says \"$omega = 1$\"","card":"a Title that says \"Feedback Control — Frequency Response: From Poles and Zeros to Stability and Compensation\"","corner_fact":"a Math [text] that says \"$upright(\"at the pole:\") thin -3 thin upright(\"dB\"), thin -45 degree$\"","db_def":"a Math [text] that says \"$|G|_(upright(\"dB\")) = 20 log_10 |G(j omega)|$\"","decade_note":"a Panel that says \"One unit along the frequency axis is one decade, a factor of ten in frequency. The axis below runs from $0.1$ to $100$ radians per second.\"","dot_high":"a PlotPoint [green] labelled \"5\" drawn in mag_axes (target='mag_curve', x=0.6989700043360189)","dot_low":"a PlotPoint [green] labelled \"0.2\" drawn in mag_axes (target='mag_curve', x=-0.6989700043360187)","dot_mid":"a PlotPoint [green] labelled \"1\" drawn in mag_axes (target='mag_curve')","drive":"a FunctionPlot [gray] drawn in frame (function=<function>)","drive_2":"a FunctionPlot [gray] drawn in frame_2 (function=<function>)","drive_3":"a FunctionPlot [gray] drawn in frame_3 (function=<function>)","frame":"an Axes (x_range=(0.0, 63.0), y_range=(-1.35, 1.35), aspect=(4.0, 3.0))","frame_2":"an Axes (x_range=(0.0, 12.6), y_range=(-1.35, 1.35), aspect=(4.0, 3.0))","frame_3":"an Axes (x_range=(0.0, 2.5), y_range=(-1.35, 1.35), aspect=(4.0, 3.0))","head_cases":"a Heading that says \"The Same Plant, Three Frequencies\"","head_curves":"a Heading that says \"The Two Curves\"","head_defs":"a Heading that says \"Two Numbers per Frequency\"","mag_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-50.0, 20.0), aspect=(8.0, 3.0))","mag_curve":"a FunctionPlot [blue] drawn in mag_axes (function=<function>)","mag_def":"a Math [text] that says \"$upright(\"amplitude ratio\") = |G(j omega)|$\"","mag_skeleton":"a FunctionPlot [yellow] drawn in mag_axes (function=<function>)","phase_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-100.0, 10.0), aspect=(8.0, 3.0))","phase_curve":"a FunctionPlot [blue] drawn in phase_axes (function=<function>)","phase_def":"a Math [text] that says \"$upright(\"phase shift\") = angle G(j omega)$\"","phase_skeleton":"a FunctionPlot [yellow] drawn in phase_axes (function=<function>)","question":"a Panel that says \"Drive a linear plant with a pure sine wave. What comes out, and how does the answer depend on the driving frequency?\"","readings":"a Table [text] that says \"$omega$ $|G|$ $angle G$ 0.2 0.98 $-11 degree$ 1 0.71 $-45 degree$ 5 0.20 $-79 degree$\" (rows=(('$omega$', '$|G|$', '$angle G$'), ('0.2', '0.98', '$-11 degre…, header=True)","reply":"a FunctionPlot [blue] drawn in frame (function=<function>)","reply_2":"a FunctionPlot [blue] drawn in frame_2 (function=<function>)","reply_3":"a FunctionPlot [blue] drawn in frame_3 (function=<function>)","slope_fact":"a Math [text] that says \"$upright(\"far above the pole:\") thin -20 thin upright(\"dB/decade\")$\"","substitution":"a Math [text] that says \"$G(s) = frac(1, s + 1) quad -> quad G(j omega) = frac(1, 1 + j omega)$\""},"beats":[{"start":0,"say":"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.","live":[],"does":[[0,"card is shown on the screen, written out."],[1.5,"card: enter:write-left-to-right."],[20.956,"card is hidden from the screen — left the board."]]},{"start":22.156,"say":"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.","live":null,"does":[[22.156,"question is shown on the screen, written out."],[34.81099999999999,"question (the \"frequency\" part) is emphasized."],[43.4255,"question is hidden from the screen — left the board."],[43.4255,"question (the \"frequency\" part) is no longer emphasized."]]},{"start":44.0255,"say":"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.","live":null,"does":[[44.0255,"head_cases is shown on the screen, written out."],[50.713,"frame is shown on the screen, written out."],[52.176,"cap_low_top is shown on the screen, written out."],[54.579,"drive is shown on the screen, written out."],[56.599,"reply is shown on the screen, written out."]]},{"start":61.297000000000004,"say":"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.","live":["frame","cap_low_top","head_cases","drive","reply"],"does":[[61.297000000000004,"cap_low_bottom is shown on the screen, written out."],[67.218,"cap_low_bottom (the \"0.98\" part) is emphasized."],[70.214,"cap_low_bottom (the \"-11 degree\" part) is emphasized."],[70.214,"cap_low_bottom (the \"0.98\" part) is no longer emphasized."],[78.028,"cap_low_bottom (the \"-11 degree\" part) is no longer emphasized."]]},{"start":79.59100000000001,"say":"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.","live":["frame","cap_low_top","cap_low_bottom","head_cases","drive","reply"],"does":[[86.766,"reply is indicated — a transient flash."]]},{"start":94.64550000000001,"say":"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.","live":null,"does":[[95.319,"frame_2 is shown on the screen, written out."],[96.37500000000001,"cap_mid_top is shown on the screen, written out."],[98.245,"drive_2 is shown on the screen, written out."],[101.983,"reply_2 is shown on the screen, written out."],[102.40100000000001,"cap_mid_bottom is shown on the screen, written out."]]},{"start":110.30350000000001,"say":"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.","live":["frame","cap_low_top","cap_low_bottom","frame_2","cap_mid_top","cap_mid_bottom","head_cases","drive","reply","drive_2","reply_2"],"does":[[110.96500000000002,"frame_3 is shown on the screen, written out."],[110.96500000000002,"cap_high_top is shown on the screen, written out."],[113.49600000000002,"drive_3 is shown on the screen, written out."],[113.49600000000002,"reply_3 is shown on the screen, written out."],[114.92400000000002,"cap_high_bottom is shown on the screen, written out."],[116.89800000000002,"cap_high_bottom (the \"0.20\" part) is emphasized."],[118.81400000000002,"cap_high_bottom (the \"-79 degree\" part) is emphasized."],[118.81400000000002,"cap_high_bottom (the \"0.20\" part) is no longer emphasized."],[130.28500000000003,"cap_high_bottom is hidden from the screen — left the board."],[130.28500000000003,"cap_high_top is hidden from the screen — left the board."],[130.28500000000003,"cap_low_bottom is hidden from the screen — left the board."],[130.28500000000003,"cap_low_top is hidden from the screen — left the board."],[130.28500000000003,"cap_mid_bottom is hidden from the screen — left the board."],[130.28500000000003,"cap_mid_top is hidden from the screen — left the board."],[130.28500000000003,"frame is hidden from the screen — left the board."],[130.28500000000003,"drive is hidden from the screen — frame left the board."],[130.28500000000003,"reply is hidden from the screen — frame left the board."],[130.28500000000003,"frame_2 is hidden from the screen — left the board."],[130.28500000000003,"drive_2 is hidden from the screen — frame_2 left the board."],[130.28500000000003,"reply_2 is hidden from the screen — frame_2 left the board."],[130.28500000000003,"frame_3 is hidden from the screen — left the board."],[130.28500000000003,"drive_3 is hidden from the screen — frame_3 left the board."],[130.28500000000003,"reply_3 is hidden from the screen — frame_3 left the board."],[130.28500000000003,"head_cases is hidden from the screen — left the board."],[130.28500000000003,"cap_high_bottom (the \"-79 degree\" part) is no longer emphasized."]]},{"start":130.88500000000002,"say":"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.","live":[],"does":[[130.88500000000002,"head_defs is shown on the screen, written out."],[136.387,"substitution is shown on the screen, written out."]]},{"start":146.06650000000002,"say":"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.","live":["substitution","head_defs"],"does":[[146.68200000000002,"mag_def is shown on the screen, written out."],[153.20600000000002,"phase_def is shown on the screen, written out."]]},{"start":165.02150000000003,"say":"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.","live":["substitution","mag_def","phase_def","head_defs"],"does":[[171.82500000000002,"db_def is shown on the screen, written out."],[178.71,"db_def (the \"20 log_10\" part) is emphasized."],[184.87550000000005,"db_def (the \"20 log_10\" part) is no longer emphasized."]]},{"start":185.47550000000004,"say":"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.","live":["substitution","mag_def","phase_def","db_def","head_defs"],"does":[[191.24500000000003,"decade_note is shown on the screen, written out."],[202.20500000000004,"db_def is hidden from the screen — left the board."],[202.20500000000004,"decade_note is hidden from the screen — left the board."],[202.20500000000004,"head_defs is hidden from the screen — left the board."],[202.20500000000004,"mag_def is hidden from the screen — left the board."],[202.20500000000004,"phase_def is hidden from the screen — left the board."],[202.20500000000004,"substitution is hidden from the screen — left the board."]]},{"start":202.80500000000004,"say":"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.","live":[],"does":[[202.80500000000004,"head_curves is shown on the screen, written out."],[203.87300000000005,"mag_axes is shown on the screen, written out."],[206.14900000000003,"mag_curve is shown on the screen, drawn."],[214.85600000000005,"dot_low is shown on the screen, written out."],[215.70400000000004,"dot_mid is shown on the screen, written out."],[216.45900000000003,"dot_high is shown on the screen, written out."]]},{"start":217.95250000000004,"say":"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.","live":["mag_axes","head_curves","mag_curve","dot_low","dot_mid","dot_high"],"does":[[228.30900000000003,"mag_axes moves to a new place on the board."],[228.30900000000003,"readings is shown on the screen, written out."],[229.60900000000004,"readings is shown on the screen, written out."],[229.80900000000003,"readings is shown on the screen, written out."],[230.20900000000003,"readings is shown on the screen, written out."]]},{"start":232.46150000000006,"say":"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.","live":null,"does":[[232.46150000000006,"phase_axes is shown on the screen, written out."],[234.98100000000005,"phase_curve is shown on the screen, drawn."],[238.26700000000002,"angle_low is shown on the screen, written out."],[240.85600000000002,"angle_mid is shown on the screen, written out."],[244.00200000000004,"angle_high is shown on the screen, written out."]]},{"start":249.57100000000005,"say":"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.","live":["mag_axes","phase_axes","head_curves","mag_curve","dot_low","dot_mid","dot_high","phase_curve","angle_low","angle_mid","angle_high"],"does":[[254.49400000000003,"mag_skeleton is shown on the screen, drawn."],[257.17600000000004,"slope_fact is shown on the screen, written out."],[261.76200000000006,"phase_skeleton is shown on the screen, drawn."],[263.004,"corner_fact is shown on the screen, written out."]]},{"start":265.9605000000001,"say":"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.","live":["slope_fact","corner_fact","mag_axes","phase_axes","head_curves","mag_curve","dot_low","dot_mid","dot_high","phase_curve","angle_low","angle_mid","angle_high","mag_skeleton","phase_skeleton"],"does":[[270.547,"mag_skeleton is indicated — a transient flash."],[270.547,"phase_skeleton is indicated — a transient flash."]]},{"start":279.2275000000001,"say":"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.","live":null,"does":[[299.1740000000001,"mag_curve is indicated — a transient flash."],[299.1740000000001,"phase_curve is indicated — a transient flash."],[300.1218333333334,"corner_fact is hidden from the screen — left the board."],[300.1218333333334,"head_curves is hidden from the screen — left the board."],[300.1218333333334,"mag_axes is hidden from the screen — left the board."],[300.1218333333334,"mag_curve is hidden from the screen — mag_axes left the board."],[300.1218333333334,"dot_low is hidden from the screen — mag_axes left the board."],[300.1218333333334,"dot_mid is hidden from the screen — mag_axes left the board."],[300.1218333333334,"dot_high is hidden from the screen — mag_axes left the board."],[300.1218333333334,"mag_skeleton is hidden from the screen — mag_axes left the board."],[300.1218333333334,"phase_axes is hidden from the screen — left the board."],[300.1218333333334,"phase_curve is hidden from the screen — phase_axes left the board."],[300.1218333333334,"angle_low is hidden from the screen — phase_axes left the board."],[300.1218333333334,"angle_mid is hidden from the screen — phase_axes left the board."],[300.1218333333334,"angle_high is hidden from the screen — phase_axes left the board."],[300.1218333333334,"phase_skeleton is hidden from the screen — phase_axes left the board."],[300.1218333333334,"readings is hidden from the screen — left the board."],[300.1218333333334,"slope_fact is hidden from the screen — left the board."]]}]},{"title":"The Four Building Blocks","start":301.1635000000001,"end":614.0257708333334,"objects":{"angle_add":"a Math [text] that says \"$angle G = angle N_1 + angle N_2 - angle D_1 - angle D_2$\"","db_add":"a Math [text] that says \"$|G|_(upright(\"dB\")) = |K|_(upright(\"dB\")) + |N_1|_(upright(\"dB\")) + |N_2|_(upright(\"dB\")) - |D_1|_(upright(\"dB\")) - |D_2|_(upright(\"dB\"))$\"","error_note":"a Math [text] that says \"$|1 + j| = sqrt(2) quad -> quad -3.01 thin upright(\"dB\")$\"","gain_plot":"a FunctionPlot [green] labelled \"20 log_10 K\" drawn in mag_axes (function=<function>)","half_decade":"a Math [text] that says \"$upright(\"half a decade out:\") thin -1 thin upright(\"dB\")$\"","head_blocks":"a Heading that says \"One Factor at a Time\"","head_law":"a Heading that says \"Multiplication Becomes Addition\"","head_rules":"a Heading that says \"The Whole Vocabulary\"","integrator_angle":"a FunctionPlot [magenta] drawn in phase_axes (function=<function>)","integrator_plot":"a FunctionPlot [magenta] drawn in mag_axes (function=<function>)","law_note":"a Panel that says \"Every curve in this lecture is a sum of a handful of simple curves, and there are only four kinds of them.\"","limits":"a Derivation [text] that says \"$G(j omega) &= frac(1, 1 + j omega / omega_p) \\ omega -> 0: quad &approx 1 \\ omega -> infinity: quad &approx frac(omega_p, j omega) \\ omega = omega_p: quad &= frac(1, 1 + j)$\"","mag_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-50.0, 40.0), aspect=(8.0, 3.0))","phase_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-100.0, 100.0), aspect=(8.0, 3.0))","point":"a Point [yellow] drawn in mag_axes (location=(0.5, 6.02))","point_2":"a Point [yellow] drawn in mag_axes","point_3":"a Point [yellow] drawn in mag_axes (location=(1.0, -20.0))","point_4":"a Point [yellow] drawn in mag_axes (location=(2.0, -40.0))","point_5":"a Point [yellow] drawn in mag_axes (location=(0.3010299956639812, 0.0))","point_6":"a Point [yellow] drawn in phase_axes (location=(0.3010299956639812, -45.0))","pole_angle":"a FunctionPlot [blue] drawn in phase_axes (function=<function>)","pole_angle_lines":"a FunctionPlot [yellow] drawn in phase_axes (function=<function>)","pole_lines":"a FunctionPlot [yellow] drawn in mag_axes (function=<function>)","pole_plot":"a FunctionPlot [blue] drawn in mag_axes (function=<function>)","product":"a Math [text] that says \"$G(j omega) = K dot.op frac(N_1 N_2, D_1 D_2)$\"","rules":"a Table [text] that says \"Factor Slope, dB per decade Phase gain $K$ $0$ $0 degree$ integrator $-20$ everywhere $-90 degree$ everywhere zero at $omega_z$ $0$, then $+20$ $0 degree$, then $+90 degree$ pole at $omega_p$ $0$, then $-20$ $0 degree$, then $-90 degree$\" (rows=(('Factor', 'Slope, dB per decade', 'Phase'), ('gain $K$', '$0$…, header=True)","rules_note":"a Panel that says \"A break costs a decade either side in phase, and the magnitude misses its corner by $3$ decibels. Those two facts are the entire error budget of a straight line sketch.\"","zero_angle":"a FunctionPlot [red] drawn in phase_axes (function=<function>)","zero_angle_lines":"a FunctionPlot [yellow] drawn in phase_axes (function=<function>)","zero_lines":"a FunctionPlot [yellow] drawn in mag_axes (function=<function>)","zero_plot":"a FunctionPlot [red] drawn in mag_axes (function=<function>)"},"beats":[{"start":301.1635000000001,"say":"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.","live":[],"does":[[301.1635000000001,"head_law is shown on the screen, written out."],[312.3675000000001,"product is shown on the screen, written out."]]},{"start":318.5165000000001,"say":"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.","live":["product","head_law"],"does":[[318.5165000000001,"db_add is shown on the screen, written out."],[325.14550000000014,"db_add (the \"|N_1|_(upright(\"dB\"))\" part) is emphasized."],[328.7215000000001,"db_add (the \"|D_1|_(upright(\"dB\"))\" part) is emphasized."],[328.7215000000001,"db_add (the \"|N_1|_(upright(\"dB\"))\" part) is no longer emphasized."],[331.62400000000014,"db_add (the \"|D_1|_(upright(\"dB\"))\" part) is no longer emphasized."]]},{"start":332.2240000000001,"say":"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.","live":["product","db_add","head_law"],"does":[[332.9785000000001,"angle_add is shown on the screen, written out."],[340.3515000000001,"law_note is shown on the screen, written out."]]},{"start":343.34300000000013,"say":"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.","live":["product","db_add","angle_add","law_note","head_law"],"does":[[350.6110000000001,"angle_add is hidden from the screen — left the board."],[350.6110000000001,"db_add is hidden from the screen — left the board."],[350.6110000000001,"head_law is hidden from the screen — left the board."],[350.6110000000001,"law_note is hidden from the screen — left the board."],[350.6110000000001,"product is hidden from the screen — left the board."]]},{"start":351.2110000000001,"say":"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.","live":[],"does":[[351.2110000000001,"head_blocks is shown on the screen, written out."],[355.3435000000001,"mag_axes is shown on the screen, written out."],[359.2215000000001,"gain_plot is shown on the screen, written out."],[363.99350000000015,"point is shown on the screen, grown."],[365.99350000000015,"point is hidden from the screen."],[370.0195000000001,"mag_axes moves to a new place on the board."],[370.0195000000001,"phase_axes is shown on the screen, written out."]]},{"start":371.50150000000014,"say":"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.","live":["mag_axes","phase_axes","head_blocks","gain_plot"],"does":[[382.9715000000001,"integrator_plot is shown on the screen, drawn."]]},{"start":386.6945000000001,"say":"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.","live":["mag_axes","phase_axes","head_blocks","gain_plot","integrator_plot"],"does":[[391.7795000000001,"point_2 is shown on the screen, grown."],[393.7765000000001,"point_3 is shown on the screen, grown."],[393.7795000000001,"point_2 is hidden from the screen."],[395.7765000000001,"point_3 is hidden from the screen."],[396.5405000000001,"point_4 is shown on the screen, grown."],[398.5405000000001,"point_4 is hidden from the screen."]]},{"start":402.4690000000001,"say":"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.","live":null,"does":[[409.2835000000001,"integrator_angle is shown on the screen, written out."]]},{"start":413.6685000000001,"say":"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.","live":["mag_axes","phase_axes","head_blocks","gain_plot","integrator_plot","integrator_angle"],"does":[[418.4755000000001,"limits is shown on the screen, written out."]]},{"start":429.8610000000001,"say":"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.","live":null,"does":[[434.3895000000001,"limits is shown on the screen, written out."],[441.68050000000017,"integrator_plot is hidden from the screen."],[441.68050000000017,"integrator_angle is hidden from the screen."],[441.68050000000017,"pole_plot is shown on the screen, drawn."]]},{"start":443.40650000000016,"say":"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.","live":["mag_axes","phase_axes","head_blocks","gain_plot","pole_plot"],"does":[[445.63550000000015,"limits is shown on the screen, written out."]]},{"start":457.6830000000001,"say":"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.","live":null,"does":[[469.26950000000016,"pole_lines is shown on the screen, drawn."],[471.10450000000014,"point_5 is shown on the screen, grown."],[473.10450000000014,"point_5 is hidden from the screen."]]},{"start":474.18900000000014,"say":"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.","live":["mag_axes","phase_axes","head_blocks","gain_plot","pole_plot","pole_lines"],"does":[[478.17150000000015,"limits is shown on the screen, written out."],[484.32450000000017,"error_note is shown on the screen, written out."]]},{"start":491.22900000000016,"say":"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.","live":["error_note","mag_axes","phase_axes","head_blocks","gain_plot","pole_plot","pole_lines"],"does":[[491.57750000000016,"half_decade is shown on the screen, written out."]]},{"start":505.1450000000001,"say":"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.","live":["error_note","half_decade","mag_axes","phase_axes","head_blocks","gain_plot","pole_plot","pole_lines"],"does":[[510.62550000000016,"pole_angle is shown on the screen, drawn."],[516.5235000000001,"pole_angle_lines is shown on the screen, drawn."]]},{"start":520.4435000000001,"say":"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.","live":["error_note","half_decade","mag_axes","phase_axes","head_blocks","gain_plot","pole_plot","pole_lines","pole_angle","pole_angle_lines"],"does":[[522.5215000000002,"point_6 is shown on the screen, grown."],[524.5215000000002,"point_6 is hidden from the screen."]]},{"start":536.0440000000001,"say":"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.","live":null,"does":[[536.0440000000001,"pole_plot is hidden from the screen."],[536.0440000000001,"pole_lines is hidden from the screen."],[536.0440000000001,"pole_angle is hidden from the screen."],[536.0440000000001,"pole_angle_lines is hidden from the screen."],[542.5105000000001,"zero_plot is shown on the screen, drawn."],[543.3695000000001,"zero_lines is shown on the screen, written out."],[546.5275000000001,"zero_angle is shown on the screen, drawn."],[547.4905000000001,"zero_angle_lines is shown on the screen, written out."]]},{"start":549.9365000000001,"say":"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.","live":["error_note","half_decade","mag_axes","phase_axes","head_blocks","gain_plot","zero_plot","zero_lines","zero_angle","zero_angle_lines"],"does":[[552.9675000000002,"zero_plot is indicated — a transient flash."],[552.9675000000002,"zero_angle is indicated — a transient flash."],[558.9810000000001,"error_note is hidden from the screen — left the board."],[558.9810000000001,"half_decade is hidden from the screen — left the board."],[558.9810000000001,"head_blocks is hidden from the screen — left the board."],[558.9810000000001,"limits is hidden from the screen — left the board."],[558.9810000000001,"mag_axes is hidden from the screen — left the board."],[558.9810000000001,"gain_plot is hidden from the screen — mag_axes left the board."],[558.9810000000001,"zero_plot is hidden from the screen — mag_axes left the board."],[558.9810000000001,"zero_lines is hidden from the screen — mag_axes left the board."],[558.9810000000001,"phase_axes is hidden from the screen — left the board."],[558.9810000000001,"zero_angle is hidden from the screen — phase_axes left the board."],[558.9810000000001,"zero_angle_lines is hidden from the screen — phase_axes left the board."]]},{"start":560.1810000000002,"say":"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.","live":[],"does":[[560.1810000000002,"head_rules is shown on the screen, written out."],[561.1915000000001,"rules is shown on the screen, written out."],[563.6405000000002,"rules is shown on the screen, written out."],[566.3225000000002,"rules (the \"row=2\" part) is emphasized."],[568.4355000000002,"rules is shown on the screen, written out."],[568.4355000000002,"rules (the \"row=2\" part) is no longer emphasized."],[571.4655000000002,"rules (the \"row=3\" part) is emphasized."],[574.4615000000001,"rules (the \"row=3\" part) is no longer emphasized."]]},{"start":575.0615000000001,"say":"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.","live":["head_rules"],"does":[[575.5485000000001,"rules is shown on the screen, written out."],[581.4235000000001,"rules (the \"row=4\" part) is emphasized."],[584.0945000000002,"rules is shown on the screen, written out."],[584.7325000000002,"rules (the \"row=4\" part) is no longer emphasized."],[586.2425000000002,"rules (the \"row=5\" part) is emphasized."],[588.7270000000001,"rules (the \"row=5\" part) is no longer emphasized."]]},{"start":589.3270000000001,"say":"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.","live":null,"does":[[590.1505000000002,"rules_note is shown on the screen, written out."]]},{"start":602.97,"say":"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.","live":["rules_note","head_rules"],"does":[[612.9841041666667,"head_rules is hidden from the screen — left the board."],[612.9841041666667,"rules is hidden from the screen — left the board."],[612.9841041666667,"rules_note is hidden from the screen — left the board."]]}]},{"title":"Stacking the Factors","start":614.0257708333334,"end":914.9500833333334,"objects":{"bode_work":"a Derivation [text] that says \"$L(s) &= frac(40, s (s + 2)(s + 10)) \\ &= frac(2, s) dot.op frac(1, 1 + s / 2) dot.op frac(1, 1 + s / 10)$\"","cross_work":"a Derivation [text] that says \"$-90 degree - arctan frac(omega, 2) - arctan frac(omega, 10) &= -180 degree \\ arctan frac(omega, 2) + arctan frac(omega, 10) &= 90 degree \\ 1 - frac(omega^2, 20) &= 0 \\ omega_(upright(\"pc\")) &= sqrt(20) approx 4.47$\"","factors":"a Block [text] that says \"a gain of $2$, worth $6$ decibels one integrator a pole at $omega = 2$ a pole at $omega = 10$\"","gc_dot":"a PlotPoint [green] drawn in mag_axes (target='mag_curve', x=0.19284611518884168)","gc_guide":"a Line [green] drawn in mag_axes (start=(0.19284611518884168, -85.0), end=(0.19284611518884168, 45.0), dashed=True)","gc_line":"a Math [text] that says \"$omega_(upright(\"gc\")) approx 1.56 quad (|L| = 1)$\"","head_build":"a Heading that says \"Laying Down the Skeleton\"","head_cross":"a Heading that says \"The Two Crossover Frequencies\"","head_form":"a Heading that says \"Putting a Plant into Bode Form\"","mag_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-90.0, 50.0), aspect=(8.0, 3.0))","mag_curve":"a FunctionPlot [blue] drawn in mag_axes (function=<function>)","mag_work":"a Derivation [text] that says \"$omega = 0.1: quad &6 + 20 = 26 \\ omega = 2: quad &6 - 6 = 0 \\ omega = 10: quad &0 - 40 log_10 5 = -28$\"","minus_180":"a Line [gray] drawn in phase_axes (start=(-1.0, -180.0), end=(2.0, -180.0), dashed=True)","pc_dot":"a PlotPoint [red] drawn in phase_axes (target='phase_curve', x=0.6505149978319906)","pc_guide":"a Line [red] drawn in phase_axes (start=(0.6505149978319906, -280.0), end=(0.6505149978319906, -70.0), dashed=True)","phase_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-285.0, -60.0), aspect=(8.0, 3.0))","phase_curve":"a FunctionPlot [blue] drawn in phase_axes (function=<function>)","phase_four":"a Line [yellow] drawn in phase_axes (start=(1.3010299956639813, -238.54634980487916), end=(2.0, -270.0))","phase_one":"a Line [yellow] drawn in phase_axes (start=(-1.0, -90.0), end=(-0.6989700043360187, -90.0))","phase_three":"a Line [yellow] drawn in phase_axes (start=(0.0, -121.45365019512084), end=(1.3010299956639813, -238.54634980487916))","phase_two":"a Line [yellow] drawn in phase_axes (start=(-0.6989700043360187, -90.0), end=(0.0, -121.45365019512084))","point":"a Point [yellow] drawn in mag_axes (location=(0.3010299956639812, 0.0))","point_2":"a Point [yellow] drawn in mag_axes (location=(1.0, -13.979400086720375))","point_3":"a Point [yellow] drawn in mag_axes (location=(0.3010299956639812, -3.0))","point_4":"a Point [yellow] drawn in mag_axes (location=(0.3010299956639812, 0.0))","seg_one":"a Line [yellow] labelled \"-20\" drawn in mag_axes (start=(-1.0, 26.020599913279625), end=(0.3010299956639812, 0.0))","seg_three":"a Line [yellow] labelled \"-60\" drawn in mag_axes (start=(1.0, -13.979400086720375), end=(2.0, -53.979400086720375))","seg_two":"a Line [yellow] labelled \"-40\" drawn in mag_axes (start=(0.3010299956639812, 0.0), end=(1.0, -13.979400086720375))","sketch_gap":"a Math [text] that says \"$upright(\"skeleton says\") thin 2.0, quad upright(\"exact\") thin 1.56$\"","zero_db_line":"a Line [gray] drawn in mag_axes (start=(-1.0, 0.0), end=(2.0, 0.0), dashed=True)"},"beats":[{"start":614.0257708333334,"say":"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.","live":[],"does":[[614.0257708333334,"head_form is shown on the screen, written out."],[617.1607708333333,"bode_work is shown on the screen, written out."]]},{"start":628.5462708333333,"say":"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.","live":["head_form"],"does":[[637.3107708333333,"bode_work is shown on the screen, written out."]]},{"start":641.5567708333333,"say":"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.","live":null,"does":[[641.5567708333333,"factors is shown on the screen, written out."],[647.7217708333334,"factors (the \"a gain of $2$, worth $6$ decibels\" part) is emphasized."],[650.5777708333334,"factors (the \"a gain of $2$, worth $6$ decibels\" part) is no longer emphasized."],[650.5777708333334,"factors (the \"one integrator\" part) is emphasized."],[652.1677708333334,"factors (the \"a pole at $omega = 2$\" part) is emphasized."],[652.1677708333334,"factors (the \"one integrator\" part) is no longer emphasized."],[654.3277708333334,"factors (the \"a pole at $omega = 10$\" part) is emphasized."],[654.3277708333334,"factors (the \"a pole at $omega = 2$\" part) is no longer emphasized."],[656.5337708333334,"factors (the \"a pole at $omega = 10$\" part) is no longer emphasized."]]},{"start":660.6857708333333,"say":"So let us draw it. I will lay the magnitude down first, one segment at a time, and check a number at every break.","live":["factors","head_form"],"does":[[668.3367708333334,"factors moves to a new place on the board."],[668.3367708333334,"bode_work is hidden from the screen — left the board."],[668.3367708333334,"head_form is hidden from the screen — left the board."]]},{"start":668.9367708333333,"say":"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.","live":["factors"],"does":[[668.9367708333333,"head_build is shown on the screen, written out."],[668.9367708333333,"mag_axes is shown on the screen, written out."],[678.3987708333334,"zero_db_line is shown on the screen, written out."]]},{"start":683.5267708333333,"say":"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.","live":["factors","mag_axes","head_build","zero_db_line"],"does":[[694.7657708333334,"mag_work is shown on the screen, written out."],[696.8317708333334,"seg_one is shown on the screen, drawn."]]},{"start":699.8237708333334,"say":"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.","live":["factors","mag_axes","head_build","zero_db_line","seg_one"],"does":[[712.1187708333333,"mag_work is shown on the screen, written out."],[713.3147708333333,"point is shown on the screen, grown."],[715.3147708333333,"point is hidden from the screen."]]},{"start":715.3657708333334,"say":"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.","live":null,"does":[[721.8677708333333,"seg_two is shown on the screen, drawn."]]},{"start":727.4597708333333,"say":"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.","live":["factors","mag_axes","head_build","zero_db_line","seg_one","seg_two"],"does":[[736.3417708333334,"mag_work is shown on the screen, written out."],[739.1507708333334,"point_2 is shown on the screen, grown."],[741.1507708333334,"point_2 is hidden from the screen."]]},{"start":741.4462708333333,"say":"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.","live":null,"does":[[744.9757708333334,"seg_three is shown on the screen, drawn."]]},{"start":754.7762708333333,"say":"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.","live":["factors","mag_axes","head_build","zero_db_line","seg_one","seg_two","seg_three"],"does":[[755.7687708333333,"mag_curve is shown on the screen, drawn."],[761.1097708333334,"point_3 is shown on the screen, grown."],[763.1097708333334,"point_3 is hidden from the screen."]]},{"start":766.8182708333334,"say":"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.","live":["factors","mag_axes","head_build","zero_db_line","seg_one","seg_two","seg_three","mag_curve"],"does":[[766.8182708333334,"phase_axes is shown on the screen, written out."],[772.1697708333334,"phase_one is shown on the screen, drawn."]]},{"start":780.1537708333333,"say":"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.","live":["factors","mag_axes","phase_axes","head_build","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one"],"does":[[789.1517708333333,"phase_two is shown on the screen, drawn."]]},{"start":792.0152708333334,"say":"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.","live":["factors","mag_axes","phase_axes","head_build","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two"],"does":[[803.3007708333333,"phase_three is shown on the screen, drawn."]]},{"start":805.5722708333333,"say":"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.","live":["factors","mag_axes","phase_axes","head_build","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three"],"does":[[812.1787708333334,"phase_four is shown on the screen, drawn."],[815.2787708333333,"phase_curve is shown on the screen, drawn."]]},{"start":819.0137708333333,"say":"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.","live":["factors","mag_axes","phase_axes","head_build","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three","phase_four","phase_curve"],"does":[[828.4642708333333,"factors is hidden from the screen — left the board."],[828.4642708333333,"head_build is hidden from the screen — left the board."],[828.4642708333333,"mag_work is hidden from the screen — left the board."]]},{"start":829.0642708333334,"say":"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.","live":["mag_axes","phase_axes","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three","phase_four","phase_curve"],"does":[[829.0642708333334,"head_cross is shown on the screen, written out."],[836.9477708333333,"minus_180 is shown on the screen, written out."]]},{"start":840.2762708333333,"say":"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.","live":["mag_axes","phase_axes","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three","phase_four","phase_curve","head_cross","minus_180"],"does":[[842.5747708333333,"cross_work is shown on the screen, written out."],[848.4847708333333,"cross_work is shown on the screen, written out."]]},{"start":852.6487708333333,"say":"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.","live":null,"does":[[858.0357708333333,"cross_work is shown on the screen, written out."]]},{"start":863.5817708333333,"say":"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.","live":null,"does":[[866.4957708333334,"cross_work is shown on the screen, written out."],[868.2837708333333,"pc_guide is shown on the screen, written out."],[874.0307708333332,"pc_dot is shown on the screen, written out."]]},{"start":876.1517708333333,"say":"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.","live":["mag_axes","phase_axes","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three","phase_four","phase_curve","head_cross","minus_180","pc_guide","pc_dot"],"does":[[883.9777708333334,"point_4 is shown on the screen, grown."],[885.9777708333334,"point_4 is hidden from the screen."]]},{"start":889.8132708333333,"say":"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.","live":null,"does":[[892.6227708333333,"gc_line is shown on the screen, written out."],[894.5037708333333,"sketch_gap is shown on the screen, written out."],[899.1477708333333,"gc_guide is shown on the screen, written out."],[901.5157708333334,"gc_dot is shown on the screen, written out."]]},{"start":906.4817708333333,"say":"Two frequencies, both read off curves we built by hand. Now let us close the loop and find out what they are worth.","live":["mag_axes","phase_axes","zero_db_line","seg_one","seg_two","seg_three","mag_curve","phase_one","phase_two","phase_three","phase_four","phase_curve","gc_line","sketch_gap","head_cross","minus_180","pc_guide","pc_dot","gc_guide","gc_dot"],"does":[[909.7667708333333,"pc_dot is indicated — a transient flash."],[909.7667708333333,"gc_dot is indicated — a transient flash."],[913.9084166666667,"cross_work is hidden from the screen — left the board."],[913.9084166666667,"gc_line is hidden from the screen — left the board."],[913.9084166666667,"head_cross is hidden from the screen — left the board."],[913.9084166666667,"mag_axes is hidden from the screen — left the board."],[913.9084166666667,"zero_db_line is hidden from the screen — mag_axes left the board."],[913.9084166666667,"seg_one is hidden from the screen — mag_axes left the board."],[913.9084166666667,"seg_two is hidden from the screen — mag_axes left the board."],[913.9084166666667,"seg_three is hidden from the screen — mag_axes left the board."],[913.9084166666667,"mag_curve is hidden from the screen — mag_axes left the board."],[913.9084166666667,"gc_guide is hidden from the screen — mag_axes left the board."],[913.9084166666667,"gc_dot is hidden from the screen — mag_axes left the board."],[913.9084166666667,"phase_axes is hidden from the screen — left the board."],[913.9084166666667,"phase_one is hidden from the screen — phase_axes left the board."],[913.9084166666667,"phase_two is hidden from the screen — phase_axes left the board."],[913.9084166666667,"phase_three is hidden from the screen — phase_axes left the board."],[913.9084166666667,"phase_four is hidden from the screen — phase_axes left the board."],[913.9084166666667,"phase_curve is hidden from the screen — phase_axes left the board."],[913.9084166666667,"minus_180 is hidden from the screen — phase_axes left the board."],[913.9084166666667,"pc_guide is hidden from the screen — phase_axes left the board."],[913.9084166666667,"pc_dot is hidden from the screen — phase_axes left the board."],[913.9084166666667,"sketch_gap is hidden from the screen — left the board."]]}]},{"title":"Closing the Loop","start":914.9500833333334,"end":1270.0216666666668,"objects":{"damped_curve":"a FunctionPlot [blue] labelled \"K = 40\" drawn in time_axes (function=<function>)","fed_back":"a FunctionPlot [green] drawn in loop_axes (function=<function>)","fed_back_big":"a FunctionPlot [green] drawn in loop_axes (function=<function>)","gain_note":"a Math [text] that says \"$K: quad 40 -> 240 -> 280$\"","gc_guide_mag":"a Line [green] drawn in mag_axes (start=(0.19284611518884168, -85.0), end=(0.19284611518884168, 45.0), dashed=True)","gc_guide_phase":"a Line [green] drawn in phase_axes (start=(0.19284611518884168, -280.0), end=(0.19284611518884168, -70.0), dashed=True)","gm_bar":"a Line [green] labelled \"upright(\"GM\")\" drawn in mag_axes (start=(0.6505149978319906, -15.563025007672874), end=(0.6505149978319906, 0.0))","gm_def":"a Math [text] that says \"$upright(\"GM\") = frac(1, |L(j omega_(upright(\"pc\"))))|)$\"","gm_val":"a Math [text] that says \"$upright(\"GM\") = 6 approx 15.6 thin upright(\"dB\")$\"","growing_curve":"a FunctionPlot [red] labelled \"K = 280\" drawn in time_axes (function=<function>)","head_condition":"a Heading that says \"What Makes a Loop Sing\"","head_margins":"a Heading that says \"The Two Margins\"","head_push":"a Heading that says \"Pushing Past the Margin\"","inject":"a FunctionPlot [gray] drawn in loop_axes (function=<function>)","lift":"a VariableNumber","loop_axes":"an Axes (x_range=(0.0, 4.3), y_range=(-1.35, 1.35), aspect=(6.0, 3.0))","loop_work":"a Derivation [text] that says \"$Y(s) &= frac(L(s), 1 + L(s)) R(s) \\ 1 + L(j omega) &= 0 \\ L(j omega) &= -1 \\ |L| = 1 quad & upright(\"and\") quad angle L = -180 degree$\"","mag_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-90.0, 50.0), aspect=(8.0, 3.0))","mag_curve":"a FunctionPlot [blue] drawn in mag_axes (function=<function>)","minus_180":"a Line [gray] drawn in phase_axes (start=(-1.0, -180.0), end=(2.0, -180.0), dashed=True)","pc_dot":"a PlotPoint [red] labelled \"-15.6 thin upright(\"dB\")\" drawn in mag_axes (target='mag_curve', x=0.6505149978319906)","pc_guide_mag":"a Line [red] drawn in mag_axes (start=(0.6505149978319906, -85.0), end=(0.6505149978319906, 45.0), dashed=True)","pc_guide_phase":"a Line [red] drawn in phase_axes (start=(0.6505149978319906, -280.0), end=(0.6505149978319906, -70.0), dashed=True)","period_brace":"a Brace [yellow] labelled \"T = 1.4 thin upright(\"s\")\" drawn in time_axes (x_start=6.0, x_end=7.404962946208145, y=-1.0)","phase_axes":"an Axes (x_range=(-1.0, 2.0), y_range=(-285.0, -60.0), aspect=(8.0, 3.0))","phase_curve":"a FunctionPlot [blue] drawn in phase_axes (function=<function>)","pm_bar":"a Line [green] labelled \"upright(\"PM\")\" drawn in phase_axes (start=(0.19284611518884168, -180.0), end=(0.19284611518884168, -136.8))","pm_def":"a Math [text] that says \"$upright(\"PM\") = 180 degree + angle L(j omega_(upright(\"gc\")))$\"","pm_val":"a Math [text] that says \"$upright(\"PM\") = 180 degree - 137 degree = 43 degree$\"","point":"a Point [yellow] drawn in mag_axes (location=(0.6505149978319906, 0.0))","returned":"a FunctionPlot [blue] drawn in loop_axes (function=<function>)","sustained_curve":"a FunctionPlot [yellow] labelled \"K = 240\" drawn in time_axes (function=<function>)","target":"a Line [gray] drawn in time_axes (start=(0.0, 1.0), end=(10.0, 1.0), dashed=True)","time_axes":"an Axes (x_range=(0.0, 10.0), y_range=(-4.0, 6.0), aspect=(6.0, 4.0))","zero_db_line":"a Line [gray] drawn in mag_axes (start=(-1.0, 0.0), end=(2.0, 0.0), dashed=True)"},"beats":[{"start":914.9500833333334,"say":"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.","live":[],"does":[[914.9500833333334,"head_condition is shown on the screen, written out."],[918.7460833333334,"loop_work is shown on the screen, written out."]]},{"start":927.2415833333334,"say":"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.","live":["head_condition"],"does":[[930.0050833333333,"loop_work is shown on the screen, written out."],[938.5730833333334,"loop_work is shown on the screen, written out."]]},{"start":940.3805833333334,"say":"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.","live":null,"does":[[946.1390833333334,"loop_work is shown on the screen, written out."],[947.7990833333334,"loop_work (the \"|L| = 1\" part) is emphasized."],[951.8280833333334,"loop_work (the \"angle L = -180 degree\" part) is emphasized."],[951.8280833333334,"loop_work (the \"|L| = 1\" part) is no longer emphasized."],[955.2875833333334,"loop_work (the \"angle L = -180 degree\" part) is no longer emphasized."]]},{"start":955.8875833333334,"say":"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.","live":null,"does":[[961.4480833333334,"loop_axes is shown on the screen, written out."],[970.0280833333334,"inject is shown on the screen, written out."]]},{"start":971.7075833333334,"say":"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.","live":["loop_axes","head_condition","inject"],"does":[[975.0860833333334,"returned is shown on the screen, written out."],[980.8910833333334,"returned is indicated — a transient flash."]]},{"start":989.0840833333334,"say":"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.","live":["loop_axes","head_condition","inject","returned"],"does":[[999.6260833333334,"fed_back is shown on the screen, written out."],[1003.1210833333334,"fed_back is indicated — a transient flash."]]},{"start":1008.5970833333334,"say":"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.","live":["loop_axes","head_condition","inject","returned","fed_back"],"does":[[1016.4800833333334,"inject is indicated — a transient flash."]]},{"start":1021.0275833333334,"say":"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.","live":null,"does":[[1029.8040833333334,"fed_back_big is shown on the screen, drawn."]]},{"start":1034.8855833333334,"say":"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.","live":["loop_axes","head_condition","inject","returned","fed_back","fed_back_big"],"does":[[1036.3250833333334,"inject is indicated — a transient flash."],[1046.8675833333334,"head_condition is hidden from the screen — left the board."],[1046.8675833333334,"loop_axes is hidden from the screen — left the board."],[1046.8675833333334,"inject is hidden from the screen — loop_axes left the board."],[1046.8675833333334,"returned is hidden from the screen — loop_axes left the board."],[1046.8675833333334,"fed_back is hidden from the screen — loop_axes left the board."],[1046.8675833333334,"fed_back_big is hidden from the screen — loop_axes left the board."],[1046.8675833333334,"loop_work is hidden from the screen — left the board."]]},{"start":1047.4675833333333,"say":"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.","live":[],"does":[[1047.4675833333333,"head_margins is shown on the screen, written out."],[1048.1530833333334,"mag_axes is shown on the screen, written out."],[1048.1530833333334,"phase_axes is shown on the screen, written out."],[1049.6040833333334,"mag_curve is shown on the screen, drawn."],[1049.6040833333334,"phase_curve is shown on the screen, drawn."],[1052.2390833333334,"zero_db_line is shown on the screen, written out."],[1052.2390833333334,"minus_180 is shown on the screen, written out."]]},{"start":1058.8765833333334,"say":"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.","live":["mag_axes","phase_axes","head_margins","mag_curve","phase_curve","zero_db_line","minus_180"],"does":[[1063.7760833333334,"pc_guide_phase is shown on the screen, written out."],[1066.1090833333333,"pc_guide_mag is shown on the screen, written out."],[1067.1660833333333,"pc_dot is shown on the screen, written out."],[1069.1860833333335,"gm_bar is shown on the screen, written out."]]},{"start":1073.5940833333334,"say":"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.","live":["mag_axes","phase_axes","head_margins","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gm_bar"],"does":[[1074.4530833333333,"gm_def is shown on the screen, written out."],[1079.6770833333335,"gm_val is shown on the screen, written out."],[1081.9180833333335,"gm_val (the \"6\" part) is emphasized."],[1084.4260833333333,"gm_val (the \"6\" part) is no longer emphasized."]]},{"start":1085.0260833333334,"say":"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.","live":["gm_def","gm_val","mag_axes","phase_axes","head_margins","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gm_bar"],"does":[[1092.1200833333335,"gc_guide_mag is shown on the screen, written out."],[1095.7420833333333,"gc_guide_phase is shown on the screen, written out."]]},{"start":1098.4900833333334,"say":"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.","live":["gm_def","gm_val","mag_axes","phase_axes","head_margins","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gm_bar","gc_guide_mag","gc_guide_phase"],"does":[[1103.2150833333333,"pm_bar is shown on the screen, written out."],[1106.9080833333333,"pm_def is shown on the screen, written out."],[1108.9860833333335,"pm_val is shown on the screen, written out."]]},{"start":1113.1270833333333,"say":"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.","live":["gm_def","gm_val","pm_def","pm_val","mag_axes","phase_axes","head_margins","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gm_bar","gc_guide_mag","gc_guide_phase","pm_bar"],"does":[[1128.3010833333333,"pm_bar is indicated — a transient flash."]]},{"start":1132.3720833333334,"say":"Forty three degrees and a factor of six. Now let me spend them.","live":null,"does":[[1136.1920833333334,"gc_guide_mag is hidden from the screen."],[1136.1920833333334,"gc_guide_phase is hidden from the screen."],[1136.1920833333334,"gm_bar is hidden from the screen."],[1136.1920833333334,"pm_bar is hidden from the screen."],[1137.1320833333334,"gm_def is hidden from the screen — left the board."],[1137.1320833333334,"gm_val is hidden from the screen — left the board."],[1137.1320833333334,"head_margins is hidden from the screen — left the board."],[1137.1320833333334,"pm_def is hidden from the screen — left the board."],[1137.1320833333334,"pm_val is hidden from the screen — left the board."]]},{"start":1137.7320833333333,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot"],"does":[[1137.7320833333333,"head_push is shown on the screen, written out."],[1144.2330833333333,"gain_note is shown on the screen, written out."]]},{"start":1155.0155833333333,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","head_push"],"does":[[1162.9560833333335,"phase_curve is indicated — a transient flash."]]},{"start":1168.6880833333335,"say":"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.","live":null,"does":[[1169.4540833333333,"mag_curve is redrawn as the numbers it depends on change."],[1169.4540833333333,"lift ticks to 15.563025007672874."]]},{"start":1179.4350833333333,"say":"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.","live":null,"does":[[1185.8320833333332,"pc_dot: one name gives way to another over the same drawing (label_becomes)."],[1191.1840833333333,"point is shown on the screen, grown."]]},{"start":1193.1540833333333,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","head_push","point"],"does":[[1193.1840833333333,"point is hidden from the screen."],[1198.0880833333333,"time_axes is shown on the screen, written out."],[1201.3740833333334,"target is shown on the screen, written out."],[1203.1620833333334,"damped_curve is shown on the screen, drawn."]]},{"start":1209.3350833333334,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","time_axes","head_push","target","damped_curve"],"does":[[1219.3310833333335,"sustained_curve is shown on the screen, drawn."]]},{"start":1223.6110833333335,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","time_axes","head_push","target","damped_curve","sustained_curve"],"does":[[1224.7250833333333,"period_brace is shown on the screen, written out."],[1235.9290833333334,"pc_guide_phase is indicated — a transient flash."]]},{"start":1239.7570833333334,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","time_axes","head_push","target","damped_curve","sustained_curve","period_brace"],"does":[[1244.9350833333333,"growing_curve is shown on the screen, drawn."]]},{"start":1255.5780833333333,"say":"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.","live":["mag_axes","phase_axes","mag_curve","phase_curve","zero_db_line","minus_180","pc_guide_phase","pc_guide_mag","pc_dot","gain_note","time_axes","head_push","target","damped_curve","sustained_curve","period_brace","growing_curve"],"does":[[1258.5850833333334,"mag_curve is redrawn as the numbers it depends on change."],[1258.5850833333334,"lift ticks to 0.0."],[1268.98,"gain_note is hidden from the screen — left the board."],[1268.98,"head_push is hidden from the screen — left the board."],[1268.98,"mag_axes is hidden from the screen — left the board."],[1268.98,"mag_curve is hidden from the screen — mag_axes left the board."],[1268.98,"zero_db_line is hidden from the screen — mag_axes left the board."],[1268.98,"pc_guide_mag is hidden from the screen — mag_axes left the board."],[1268.98,"pc_dot is hidden from the screen — mag_axes left the board."],[1268.98,"phase_axes is hidden from the screen — left the board."],[1268.98,"phase_curve is hidden from the screen — phase_axes left the board."],[1268.98,"minus_180 is hidden from the screen — phase_axes left the board."],[1268.98,"pc_guide_phase is hidden from the screen — phase_axes left the board."],[1268.98,"time_axes is hidden from the screen — left the board."],[1268.98,"target is hidden from the screen — time_axes left the board."],[1268.98,"damped_curve is hidden from the screen — time_axes left the board."],[1268.98,"sustained_curve is hidden from the screen — time_axes left the board."],[1268.98,"period_brace is hidden from the screen — time_axes left the board."],[1268.98,"growing_curve is hidden from the screen — time_axes left the board."]]}]},{"title":"Lag and Lead","start":1270.0216666666668,"end":1660.0463958333335,"objects":{"closing":"a Panel that says \"Both sections are the same two factors we met earlier: one zero and one pole. Which of them comes first is the whole difference.\"","gc_lag_ang":"a Line [green] drawn in phase_axes (start=(-0.3142582613977364, -280.0), end=(-0.3142582613977364, 55.0), dashed=True)","gc_lag_mag":"a Line [green] drawn in mag_axes (start=(-0.3142582613977364, -75.0), end=(-0.3142582613977364, 55.0), dashed=True)","gc_lead_ang":"a Line [green] drawn in phase_axes (start=(0.42324587393680785, -280.0), end=(0.42324587393680785, 55.0), dashed=True)","gc_lead_mag":"a Line [green] drawn in mag_axes (start=(0.42324587393680785, -75.0), end=(0.42324587393680785, 55.0), dashed=True)","gc_now_mag":"a Line [gray] drawn in mag_axes (start=(0.19284611518884168, -75.0), end=(0.19284611518884168, 55.0), dashed=True)","head_forms":"a Heading that says \"Two Ways to Bend the Curves\"","head_lag":"a Heading that says \"The Lag: Cut the Gain, Keep the Phase\"","head_lead":"a Heading that says \"The Lead: Buy Phase Where It Counts\"","head_summary":"a Heading that says \"The Two Trades\"","lag_ang":"a FunctionPlot [yellow] drawn in phase_axes (function=<function>)","lag_form":"a Math [text] that says \"$C(s) = frac(1 + s / 0.05, 1 + s / 0.0125)$\"","lag_mag":"a FunctionPlot [yellow] drawn in mag_axes (function=<function>)","lag_where":"a Text [text] that says \"The pole comes first, so the section is worth $1$ at low frequency and less than $1$ above the zero.\"","lag_work":"a Derivation [text] that says \"$upright(\"high frequency gain\") &= frac(0.0125, 0.05) = frac(1, 4) \\ &= -12 thin upright(\"dB\") \\ omega_(upright(\"gc\")): quad 1.56 &-> 0.49 \\ upright(\"PM\"): quad 43 degree &-> 69 degree \\ upright(\"GM\"): quad 15.6 &-> 27.6 thin upright(\"dB\")$\"","lagged_ang":"a FunctionPlot [green] drawn in phase_axes (function=<function>)","lagged_mag":"a FunctionPlot [green] drawn in mag_axes (function=<function>)","lead_ang":"a FunctionPlot [yellow] drawn in phase_axes (function=<function>)","lead_form":"a Math [text] that says \"$C(s) = frac(1 + s / 1.2, 1 + s / 7.2)$\"","lead_mag":"a FunctionPlot [yellow] drawn in mag_axes (function=<function>)","lead_where":"a Text [text] that says \"The zero comes first, so the section is worth $1$ at low frequency and more than $1$ above the pole.\"","lead_work":"a Derivation [text] that says \"$alpha = frac(1.2, 7.2) = frac(1, 6) quad &-> quad phi_m = 46 degree \\ omega_m = sqrt(1.2 dot.op 7.2) &= 2.94 \\ omega_(upright(\"gc\")): quad 1.56 &-> 2.65 \\ upright(\"PM\"): quad 43 degree &-> 68 degree \\ upright(\"GM\"): quad 15.6 &-> 15.9 thin…$\"","led_ang":"a FunctionPlot [green] drawn in phase_axes (function=<function>)","led_mag":"a FunctionPlot [green] drawn in mag_axes (function=<function>)","left_label":"a Tex [text] that says \"Lag compensator\" (underline=True)","mag_axes":"an Axes (x_range=(-2.0, 1.5), y_range=(-80.0, 60.0), aspect=(8.0, 3.0))","minus_180":"a Line [gray] drawn in phase_axes (start=(-2.0, -180.0), end=(1.5, -180.0), dashed=True)","phase_axes":"an Axes (x_range=(-2.0, 1.5), y_range=(-285.0, 60.0), aspect=(8.0, 3.0))","plant_ang":"a FunctionPlot [blue] drawn in phase_axes (function=<function>)","plant_mag":"a FunctionPlot [blue] drawn in mag_axes (function=<function>)","point":"a Point [yellow] drawn in mag_axes (location=(0.0, -12.04))","point_2":"a Point [yellow] drawn in phase_axes (location=(-1.6020599913279623, -30.0))","point_3":"a Point [yellow] drawn in phase_axes (location=(-0.3142582613977364, -110.8))","point_4":"a Point [yellow] drawn in phase_axes (location=(0.6505149978319906, -180.0))","point_5":"a Point [yellow] drawn in phase_axes (location=(0.46834733041215726, 45.6))","point_6":"a Point [yellow] drawn in phase_axes (location=(0.42324587393680785, -112.4))","right_label":"a Tex [text] that says \"Lead compensator\" (underline=True)","summary":"a Table [text] that says \"Lag Lead Magnitude cuts the high end lifts the high end Phase a small dip, parked low a bump of up to $+90 degree$ Crossover moves down moves up Buys margin by slowing the loop adding phase at crossover\" (rows=(('', 'Lag', 'Lead'), ('Magnitude', 'cuts the high end', 'lifts…, header=True)","zero_db_line":"a Line [gray] drawn in mag_axes (start=(-2.0, 0.0), end=(1.5, 0.0), dashed=True)"},"beats":[{"start":1270.0216666666668,"say":"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.","live":[],"does":[[1270.0216666666668,"head_forms is shown on the screen, written out."]]},{"start":1282.7306666666668,"say":"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.","live":["head_forms"],"does":[[1283.0326666666667,"left_label is shown on the screen, written out."],[1283.0326666666667,"right_label is shown on the screen, written out."]]},{"start":1292.3291666666667,"say":"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.","live":["left_label","right_label","head_forms"],"does":[[1295.3246666666669,"lag_form is shown on the screen, written out."],[1305.5286666666668,"lag_where is shown on the screen, written out."]]},{"start":1307.2206666666668,"say":"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.","live":["left_label","lag_form","lag_where","right_label","head_forms"],"does":[[1311.0746666666669,"lead_form is shown on the screen, written out."],[1318.8766666666668,"lead_where is shown on the screen, written out."]]},{"start":1325.2816666666668,"say":"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.","live":["left_label","lag_form","lag_where","right_label","lead_form","lead_where","head_forms"],"does":[[1332.3641666666667,"head_forms is hidden from the screen — left the board."],[1332.3641666666667,"lag_form is hidden from the screen — left the board."],[1332.3641666666667,"lag_where is hidden from the screen — left the board."],[1332.3641666666667,"lead_form is hidden from the screen — left the board."],[1332.3641666666667,"lead_where is hidden from the screen — left the board."],[1332.3641666666667,"left_label is hidden from the screen — left the board."],[1332.3641666666667,"right_label is hidden from the screen — left the board."]]},{"start":1332.9641666666666,"say":"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.","live":[],"does":[[1332.9641666666666,"head_lag is shown on the screen, written out."],[1333.7766666666666,"mag_axes is shown on the screen, written out."],[1333.7766666666666,"phase_axes is shown on the screen, written out."],[1334.7176666666667,"plant_mag is shown on the screen, drawn."],[1334.7176666666667,"plant_ang is shown on the screen, drawn."],[1337.4226666666668,"zero_db_line is shown on the screen, written out."],[1337.4226666666668,"minus_180 is shown on the screen, written out."],[1337.4226666666668,"gc_now_mag is shown on the screen, written out."]]},{"start":1346.9971666666668,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag"],"does":[[1349.8766666666668,"lag_mag is shown on the screen, drawn."]]},{"start":1363.7811666666666,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag"],"does":[[1366.2886666666668,"lag_work is shown on the screen, written out."],[1369.3426666666667,"lag_work is shown on the screen, written out."],[1374.7406666666668,"point is shown on the screen, grown."],[1376.7406666666668,"point is hidden from the screen."]]},{"start":1379.2416666666668,"say":"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.","live":null,"does":[[1380.4606666666668,"lag_ang is shown on the screen, drawn."],[1381.9466666666667,"point_2 is shown on the screen, grown."],[1383.9466666666667,"point_2 is hidden from the screen."]]},{"start":1398.5796666666668,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag","lag_ang"],"does":[[1400.8666666666668,"lagged_mag is shown on the screen, drawn."],[1400.8666666666668,"lagged_ang is shown on the screen, drawn."]]},{"start":1410.1396666666667,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag","lag_ang","lagged_mag","lagged_ang"],"does":[[1414.1446666666668,"gc_lag_mag is shown on the screen, written out."],[1420.8786666666667,"lag_work is shown on the screen, written out."]]},{"start":1423.1156666666668,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag","lag_ang","lagged_mag","lagged_ang","gc_lag_mag"],"does":[[1430.4756666666667,"gc_lag_ang is shown on the screen, written out."],[1432.4266666666667,"point_3 is shown on the screen, grown."],[1434.4266666666667,"point_3 is hidden from the screen."],[1434.7596666666668,"lag_work is shown on the screen, written out."]]},{"start":1437.8676666666668,"say":"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.","live":["mag_axes","phase_axes","head_lag","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag","lag_ang","lagged_mag","lagged_ang","gc_lag_mag","gc_lag_ang"],"does":[[1440.4566666666667,"lag_work is shown on the screen, written out."],[1444.4846666666667,"point_4 is shown on the screen, grown."],[1446.4846666666667,"point_4 is hidden from the screen."],[1456.6521666666667,"head_lag is hidden from the screen — left the board."],[1456.6521666666667,"lag_work is hidden from the screen — left the board."]]},{"start":1457.2521666666667,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","lag_mag","lag_ang","lagged_mag","lagged_ang","gc_lag_mag","gc_lag_ang"],"does":[[1457.2521666666667,"head_lead is shown on the screen, written out."],[1457.2521666666667,"lag_mag is hidden from the screen."],[1457.2521666666667,"lag_ang is hidden from the screen."],[1457.2521666666667,"lagged_mag is hidden from the screen."],[1457.2521666666667,"lagged_ang is hidden from the screen."],[1457.2521666666667,"gc_lag_mag is hidden from the screen."],[1457.2521666666667,"gc_lag_ang is hidden from the screen."],[1461.5356666666667,"lead_mag is shown on the screen, drawn."]]},{"start":1470.0886666666668,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","head_lead","lead_mag"],"does":[[1479.0866666666668,"lead_work is shown on the screen, written out."]]},{"start":1485.3636666666669,"say":"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.","live":null,"does":[[1489.1016666666667,"lead_ang is shown on the screen, drawn."],[1494.6286666666667,"point_5 is shown on the screen, grown."],[1496.6286666666667,"point_5 is hidden from the screen."],[1497.4376666666667,"lead_work is shown on the screen, written out."]]},{"start":1502.5771666666667,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","head_lead","lead_mag","lead_ang"],"does":[[1509.4496666666669,"led_mag is shown on the screen, drawn."],[1509.4496666666669,"led_ang is shown on the screen, drawn."]]},{"start":1513.7651666666668,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","head_lead","lead_mag","lead_ang","led_mag","led_ang"],"does":[[1516.9116666666669,"gc_lead_mag is shown on the screen, written out."],[1521.0106666666668,"lead_work is shown on the screen, written out."]]},{"start":1528.5416666666667,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","head_lead","lead_mag","lead_ang","led_mag","led_ang","gc_lead_mag"],"does":[[1529.5976666666668,"gc_lead_ang is shown on the screen, written out."],[1539.6406666666667,"point_6 is shown on the screen, grown."],[1541.5446666666667,"lead_work is shown on the screen, written out."],[1541.6406666666667,"point_6 is hidden from the screen."]]},{"start":1543.1896666666669,"say":"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.","live":["mag_axes","phase_axes","plant_mag","plant_ang","zero_db_line","minus_180","gc_now_mag","head_lead","lead_mag","lead_ang","led_mag","led_ang","gc_lead_mag","gc_lead_ang"],"does":[[1546.5796666666668,"lead_work is shown on the screen, written out."]]},{"start":1557.2456666666667,"say":"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.","live":null,"does":[[1567.3576666666668,"led_mag is indicated — a transient flash."],[1567.657666666667,"led_ang is indicated — a transient flash."],[1569.3196666666668,"head_lead is hidden from the screen — left the board."],[1569.3196666666668,"lead_work is hidden from the screen — left the board."],[1569.3196666666668,"mag_axes is hidden from the screen — left the board."],[1569.3196666666668,"plant_mag is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"zero_db_line is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"gc_now_mag is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"lead_mag is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"led_mag is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"gc_lead_mag is hidden from the screen — mag_axes left the board."],[1569.3196666666668,"phase_axes is hidden from the screen — left the board."],[1569.3196666666668,"plant_ang is hidden from the screen — phase_axes left the board."],[1569.3196666666668,"minus_180 is hidden from the screen — phase_axes left the board."],[1569.3196666666668,"lead_ang is hidden from the screen — phase_axes left the board."],[1569.3196666666668,"led_ang is hidden from the screen — phase_axes left the board."],[1569.3196666666668,"gc_lead_ang is hidden from the screen — phase_axes left the board."]]},{"start":1569.9196666666667,"say":"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.","live":[],"does":[[1569.9196666666667,"head_summary is shown on the screen, written out."],[1570.2676666666669,"summary is shown on the screen, written out."],[1572.7296666666668,"summary is shown on the screen, written out."],[1577.6866666666667,"summary (the \"row=2\" part) is emphasized."],[1580.6241666666667,"summary (the \"row=2\" part) is no longer emphasized."]]},{"start":1581.2241666666669,"say":"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.","live":["head_summary"],"does":[[1583.7436666666667,"summary is shown on the screen, written out."],[1589.5716666666667,"summary (the \"row=3\" part) is emphasized."],[1594.1746666666668,"summary (the \"row=3\" part) is no longer emphasized."]]},{"start":1594.7746666666667,"say":"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.","live":null,"does":[[1596.0456666666669,"summary is shown on the screen, written out."],[1598.820666666667,"summary is shown on the screen, written out."],[1602.1066666666668,"summary (the \"row=5\" part) is emphasized."],[1610.3031666666668,"summary (the \"row=5\" part) is no longer emphasized."]]},{"start":1610.9031666666667,"say":"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.","live":null,"does":[[1611.5646666666669,"closing is shown on the screen, written out."]]},{"start":1620.501166666667,"say":"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.","live":["closing","head_summary"],"does":[]},{"start":1636.4491666666668,"say":"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.","live":null,"does":[[1659.0047291666667,"closing is hidden from the screen — left the board."],[1659.0047291666667,"head_summary is hidden from the screen — left the board."],[1659.0047291666667,"summary is hidden from the screen — left the board."]]}]}]},"durationSeconds":1660,"chapters":[{"title":"Sine In, Sine Out","startSeconds":0,"narration":"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."},{"title":"The Four Building Blocks","startSeconds":301.1635000000001,"narration":"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."},{"title":"Stacking the Factors","startSeconds":614.0257708333334,"narration":"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."},{"title":"Closing the Loop","startSeconds":914.9500833333334,"narration":"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."},{"title":"Lag and Lead","startSeconds":1270.0216666666668,"narration":"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."}]}}
