Неправильный график Найквиста с использованием пакета управления python

Я пытаюсь использовать 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()

Код выводит этот график:

Выходное изображение графика Найквиста

Но сюжет должен выглядеть так (из вольфрама):

сюжет Вольфрама Найквиста

Почему график Найквиста из контрольного пакета неверен? Как я могу сделать это правильно?

Большое спасибо.


person Sergio Polimante    schedule 19.10.2020    source источник


Ответы (1)


Вам придется настроить это с помощью параметров matplotlib. Используемая вами функция nyquist передает **kwars в 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
person Santiago Echevarria    schedule 19.10.2020
comment
установите xlim и ylim для начала. Я также считаю, что вы не нормализуете значения Im и Re, как предполагает легенда о вольфраме. - person Santiago Echevarria; 20.10.2020