In this video, we're going to compare three popular methods
for visualizing the frequency response
of a linear time-invariant system the Bode plot
the Nyquist plot, and the Nichols plot.
And I want to explain what each of them are,
what some of their strengths and weaknesses are,
and why you may choose one over another.
Now to keep this video a reasonable length,
I'm going to mention but gloss over
a lot of concepts like linear systems, transfer functions,
controller design, and stability criteria.
I want to mention them so that we understand these three
plots a bit better, but if you want more information
on those other concepts, I've left a bunch of resources
in the description of this video.
OK, let's get to it.
I'm Brian, and welcome to a MATLAB Tech Talk.
Let's begin with a short overview of LTI systems.
As the name suggests, LTI systems
are linear, which means that they
have the properties of superposition and homogeneity.
And they are time invariant, which
means that their behavior does not change over time.
And the reason LTI systems are important
is because they are mathematically
easy to work with and to understand.
The tools that we have to analyze an LTI system
are much more capable than what we
have to analyze and understand non-LTI systems.
So if the thing that you're working on
can be approximated and modeled as LTI,
then that can make design and analysis much easier.
And the main thing that we need to realize with LTI systems,
for this video at least, is how the linear dynamics
affect the signals that are fed into them.
If the input is a sine wave with a frequency of omega,
amplitude A, and phase phi, then what comes out the other side
is still a sine wave at the exact same frequency
but with a potentially different amplitude and phase.
So an LTI system won't affect the frequency
or change the shape of a sinusoid,
but it will affect the gain and the phase of the signal,
and the amount of gain and phase depends
on the frequency of the input.
Therefore, we can fully describe an LTI system
by looking at how it changes the gain
and phase of every single frequency across the spectrum.
So there are three parameters that we're concerned with--
gain, phase, and frequency, and those
are what Bode plots, Nyquist plots, and Nichols plots
are displaying.
They all display the gain and the phase shift
for every single frequency.
It's just presented differently depending on how
you want to see the data.
Now in addition to displaying these parameters neatly
in graphical form, these plots are also
helpful for system identification
and closed-loop controller design.
Let's start with system identification.
Let's say that our system can be modeled by this transfer
function.
To generate a Bode, Nyquist, or Nichols plot,
we could solve the transfer function mathematically
and draw the curves using the equations that we come up with.
However, this method assumes that we already
have the transfer function to start with.
So let's assume that we don't have this model.
We're working with the hardware directly,
like a physical electrical circuit.
We know that this can be modeled as an LTI system,
but we don't yet have a model.
This is just a black box to us where
we can apply different inputs and measure the outputs.
For instance, we could apply a voltage
as a sine wave at, say, 1 radian per second
and with a known amplitude, and compare it
to the measured output voltage once all
of the initial transients die down.
And by overlaying these two, we could calculate the resulting
gain or change in amplitude and the resulting phase shift.
In this case for a frequency of 1 radian per second,
the gain increased by a factor of 2
and the signal was delayed by 90 degrees of phase.
Now, since gain can span such a large range,
we sometimes like to represent it on a log scale.
So instead of reporting a gain of 2,
we would report it in decibels with the following equation.
So the gain here is about plus 6 dB.
All right, let's bring up two graphs.
On the first, we can plot the gain or the magnitude
in dB against frequency.
And on the second, we can plot phase shift
in degrees against frequency.
So that's our one point so far for this system,
and there's not a whole lot that we can do with that,
so let's get another one.
I'll feed through an input voltage with a frequency of 1/2
a radian per second, and check this out.
At this slower frequency, the gain is nearly 1 or 0 dB,
and the phase was delayed by only about 18 degrees.
So overall, less of an impact, and we
can add these two points on our graph.
And we could choose another point at the faster 3 radians
per second.
And this higher frequency is attenuated
by more than 18 decibels.
And it's hard to see exactly, but the phase
is delayed by about 170 degrees.
Now instead of one frequency at a time,
if we input a sine sweep into this system that
starts at some super-low frequency
and slowly ramps up to the high-frequency inputs,
we can generate the frequency response for this system,
and we've created a Bode plot.
Remember, we don't have the model of this system.
We got this information by measuring the behavior
of the physical circuit.
But from this information, we can fit a model to this result.
For example, we can see that this system has a low pass
filter like behavior since the low-frequency signals are
passed nearly unaltered and the high-frequency signals
are attenuated.
We can also tell that there are two more poles than zeros
since the magnitude at higher frequencies slope down
at negative 40 dB per decade.
And we can also see that there is a slightly damped mode
around 1 radian per second.
And by looking at this Bode plot,
we could fit a transfer function or a model
to this data that approximates this response.
But more than just representing the system
and identifying the system with data,
we may also want to use this plot for design.
For example, we often want to know
what would happen if we wrapped a feedback
controller around this plant?
It turns out that we know a lot about the closed-loop behavior
by looking at the frequency response
of the open-loop system.
For instance, if there are any frequencies where
the open-loop system produces a gain of 0 dB
and a phase of minus 180 degrees,
this will cause an oscillation in the closed-loop system.
So without actually having to close the loop and test it,
we know that an open-loop system with this behavior
will be a bad closed-loop design.
So we can look across the Bode plot
and check every frequency that has a magnitude of 0 dB
and ensure that the phase isn't negative 180 degrees.
And if it's not, then we're good to go.
The closed-loop system won't have any undamped oscillations.
Of course, oscillation isn't the only thing
we're concerned with.
We also want to know if the closed-loop system is stable.
But here's where things can get a bit confusing,
and I apologize if my super-fast explanation
adds to the confusion, but let me give it a shot anyway.
If the open-loop system is minimum phase and stable--
so both its poles and zeros are in the left-half plane--
then we can determine closed-loop stability easily
from a Bode plot.
This is a Bode plot for a stable, minimum-phase,
open-loop system.
As long as the magnitude is not above 0 dB
when the phase is negative 180 degrees or the phase
is lower than negative 180 degrees
when the magnitude is 0 dB, then the closed-loop system
will be stable, which is the case
for this particular system.
And you can see that the closed-loop step
response is, in fact, stable.
So when we're dealing with these types of open-loop systems,
we often see gain and phase margin displayed
on a frequency-response plot.
This is how much the open-loop system
can increase in gain or in phase before the closed-loop system
goes unstable, before the curve goes beyond the critical point.
And loop shaping is the act of adding gain and poles and zeros
to the open-loop system in the form of a controller
to get the gain in phase margin and the performance
that you want for the closed-loop system.
And we can use a Bode plot to see
where we need to shape the response to get the stability
margins that we need, and we can see how close our design is
to becoming unstable.
Now with all of that being said, checking
for closed-loop stability with a Bode plot
is not as straightforward.
If the open-loop system is nonminimum phase
or is unstable.
Here, Gu is an unstable open-loop system.
And if we check out the Bode plot for this system,
it doesn't look like the response crosses either 0
dB or negative 180 degrees.
So you might expect that the closed-loop system
will be stable.
However, you can clearly see from this step response
that it's unstable.
So with nonminimum phase or unstable plants,
a Bode plot can be misleading.
And so this is where a Nyquist plot is useful.
A Nyquist plot still displays gain, phase, and frequency,
but it does so all on a single chart
and with polar coordinates.
Gain is the radial component or the distance from the origin
on a linear scale.
So we're not dealing with decibels here.
And phase is the angular component or distance
around the origin.
And frequency isn't shown directly,
but as we progress along this curve,
the frequency is changing.
So if we compare this to the Bode plot,
we can see that this point here has
a phase shift of 0 degrees and a gain of 1, which is 0 decibels.
But again, we're not using decibels for a Nyquist plot.
And as we can see on the Bode plot,
it corresponds to a very low frequency.
And if we increase frequency until we
get to 1 radian per second, we can
see that this is the max gain or the furthest point
from the origin, and it has a phase shift
of about negative 90 degrees.
And at the higher frequencies where
the system has very low gain, the Nyquist plot
tends towards the origin.
Now, the upper half of the Nyquist plot
is a mirror image of the lower half,
and it shows the response for negative frequencies, which
are typically not shown on the Bode plot.
Also notice the critical point, the one
we're trying to avoid for oscillations.
It's just a single point on a Nyquist plot,
and it corresponds to negative 180 degrees and a gain of 1.
So this is how the Nyquist plot packages the exact same data
that we have in the Bode plot.
But the question now might be, why are we even displaying
the data in this form?
And there are some pretty good reasons.
One is that we can determine closed-loop stability much
easier with this format.
If the open-loop system is minimum phase and stable,
then just like with the Bode plot,
we can claim that the closed-loop system is stable
as long as the curve doesn't cross over this critical point.
And since all of the information is presented in a single graph
and there's only a single critical point,
we can see very clearly how close
the curve is to it, even if there are multiple close
passes.
And gain and phase margin can still
be read directly off this chart, just
like we can with a Bode plot.
Also, the benefit of a single plot like this
is that we can more easily see how
combinations of gain and phase impact
the stability of the system.
In fact, disk margin, which is arguably a better way
to think about margin in your system,
is built on this kind of representation.
Furthermore, per the Nyquist stability criterion,
we can also determine closed-loop stability
for unstable open-loop systems, which
is something that was very difficult to do on a Bode plot.
We can compare the number and direction of encirclements
around the critical point with the number
of right-half-plane poles for the open-loop system
and then determine closed-loop stability.
So for certain systems, it's easier to check for stability
and to design a closed-loop controller with a Nyquist plot
than it is with a Bode plot.
But the downside of Nyquist is that it
tends to be harder to read since frequency is not explicitly
called out, and I find that it's not
terribly intuitive to look at a Nyquist plot
without a lot of practice.
Of course, that's entirely a preference thing and not
a statement of fact, but one of the reasons
that I think it's hard to read is
that it's harder to visualize an angular distance
than it is a straight-line distance.
For example, how much phase margin is there in this design?
Well, it's the angle between the critical point
and where the curve crosses the unit circle.
So whatever this is, maybe around 45 degrees or so.
Well, to find out exactly, let's go over
to MATLAB to analyze it, and it turns out
it's about 41.4 degrees.
So you can definitely read phase from this plot for sure,
but my personal preference is to be
able to view these margins on a Cartesian graph rather
than a polar graph.
Plus on a polar graph, we can create some pretty gnarly
results as the response curve loops
around four systems with a lot going on.
So to solve this, enter the Nichols plot.
Nichols is a single graph like Nyquist,
but it plots the information on a Cartesian grid.
Magnitude is the vertical axis in dB,
and phase is the horizontal axis in degrees.
So it's the exact same units as the Bode plot.
In fact, it is the Bode-plot information, just packaged
onto a single chart.
And I think it's easier to visualize
if we align the magnitude and phase plots with the Nichols
chart.
And as we trace through the frequencies,
you can see how the Bode-plot information is
mapped into this single graph.
A Nichols plot has some of the same benefits as the Nyquist
plot in that the information is on a single chart
so that we can visually see how combinations of gain and phase
will impact stability.
Plus it's easier to determine stability of nonminimum phase
in unstable, open-loop plants than it is for a Bode plot.
We can apply the Nyquist stability criterion
to this chart as well by counting
how many times the curve crosses above the critical frequency
and in which direction.
Also when we're talking about closed-loop design,
we can obtain the values of the closed-loop transfer
function from the open-loop frequency response
by overlaying a grid that shows the so-called M and N circles.
From this grid, we can read the gain and phase
of the closed-loop system directly.
And since adjusting the open-loop gain
causes the Nichols plot to move up or down, with the grid,
it's really easy to see how open-loop gain will
affect closed-loop response.
But a Nichols plot also has some of the same downsides
as the Nyquist plot in that frequency is still not
explicitly called out.
So Nichols and Nyquist seem pretty similar.
However, the difference is that I
think it can be easier to read off
gain and phase on a Cartesian grid rather than a polar grid.
And for open-loop systems that have a lot of phase lag,
rather than looping around the origin
a whole bunch like the Nyquist plot,
the Nichols plot just keeps moving to the left
indefinitely, adding additional critical points
every 360 degrees.
So is the Nichols plot the best?
Yes.
Yes it is.
Well, maybe not for everyone.
The plot that you rely on the most
is more than likely the one that you're most familiar with.
Like I said, they all show the same information.
But there are some situations where
it might be better to use one representation over another.
For example, I prefer to do loop shaping with a Bode plot,
assuming that the open-loop plant is stable
and minimum phase, whereas I tend to look at a Nyquist
or Nichols plot to visually see sensitivity and stability
margins.
All right, I hope this has helped
you understand the differences between these three
frequency-response plots.
Let me know in the comments which one you use most often
and for what purpose.
I'd love to see what everyone comes up with.
Don't forget that if you want to learn more
about anything that I've glossed over in this video,
like the details of the Bode plot or Nyquist stability
criterion, I've left links to many great resources
in the description.
And if you don't want to miss any other future Tech Talk
videos, don't forget to subscribe to this channel.
Also, check out my channel, Control System Lectures,
if you are interested in other control-theory topics as well.
Thanks for watching, and I'll see you next time.