当前位置: 动力学知识库 > 问答 > 编程问答 >

MATLAB Nyquist Plot - Show the unit circle

问题描述:

I cannot find out how you would show the unit circle centered at -1 on a Nyquist plot.

When I plot nyquist(L) with L(s) = P(s)*C(s) being my loop function, it only shows the nyquist plot itself. Using grid on also doesn't do this.

Can someone help me please?

网友答案:

Once you create your Nyquist plot, use hold on; so we can draw a circle in MATLAB on top of your Nyquist plot. If you recall from polar co-ordinates, we can parameterize a point on a circle to be the following:

  • x = r*cos(theta);
  • y = r*sin(theta);

r would be the radius of your circle while theta is the angle it makes with respect to the origin. theta has its domain between [0,2*pi]. For the unit circle, r = 1. We would then substitute angles (theta) between 0 to 2*pi. You also need to shift your circle so that the origin is at Re = -1, Im = 0. As such, do this:

n = 1000; %// Define number of points on circle
theta = linspace(0, 2*pi, n);
x = cos(theta);
y = sin(theta);
nyquist(L); %// Spawn Nyquist plot
hold on;
plot(x-1, y); %// Unit circle

Here's a quick example for you. Using L = tf(9, [1 6 9]); to represent our transfer function of the open-loop system, using the above code produces the following plot:

Bear in mind that I had to adjust the limits of the axis so you could see the unit circle. I did this by invokingaxis in the following way after the plot was shown:

axis([-2 2 -1 1]);

The real axis limits span from -2 to 2, and the imaginary axis limits span from -1 to 1.

分享给朋友:
您可能感兴趣的文章:
随机阅读: