我正在尝试使用python来绘制一个奈奎斯特图。然而,我不能把它做对。
这是我使用的代码:
import control
import matplotlib.pyplot as plt
#Creating a transfer function G
s = control.TransferFunction.s
K0 = 10
T = 10
G = K0 / (s**2 * (T*s + 1))
control.nyquist(G)
plt.grid(True)
plt.title('Nyquist Diagram of G(s)')
plt.xlabel('Re(s)')
plt.ylabel('Im(s)')
plt.show()
代码输出此图形:
但情节应该是这样的(来自wolfram):
为什么控制包中的Nyquist图是错误的?我怎么才能把它弄对呢?
非常感谢。
发布于 2020-10-20 06:04:54
您必须通过matplotlib参数来调整它。您正在使用的nyquist函数将**kwar传递给matplotlib。
你可以看到
control.nyquist
是的别名
# Function aliases
bode = bode_plot
nyquist = nyquist_plot
它有以下输入:
def nyquist_plot(syslist, omega=None, Plot=True, color=None,
labelFreq=0, *args, **kwargs):
"""
Nyquist plot for a system
Plots a Nyquist plot for the system over a (optional) frequency range.
Parameters
----------
syslist : list of LTI
List of linear input/output systems (single system is OK)
omega : freq_range
Range of frequencies (list or bounds) in rad/sec
Plot : boolean
If True, plot magnitude
color : string
Used to specify the color of the plot
labelFreq : int
Label every nth frequency on the plot
*args
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
**kwargs:
Additional keywords (passed to `matplotlib`)
Returns
-------
real : array
real part of the frequency response array
imag : array
imaginary part of the frequency response array
freq : array
frequencies
https://stackoverflow.com/questions/64433863
复制相似问题