Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect nyquist plot #830

Closed
Avitan01 opened this issue Dec 31, 2022 · 5 comments · Fixed by #880
Closed

Incorrect nyquist plot #830

Avitan01 opened this issue Dec 31, 2022 · 5 comments · Fixed by #880
Assignees
Milestone

Comments

@Avitan01
Copy link

I'm using the control package with python 3.10 in Pycharm and Jupiter lab.
I have stumbled upon a possible issue while trying to create a Nyquist plot for a simple system

import control as ct

s = ct.tf('s'))
plant_1 = 1/(s*(s + 5)*(s + 7)))
ct.nyquist_plot(plant_1)

The result I'm getting is this:

download

While in MATLAB I'm getting different results

clear all;
close all;
clc;


s = tf('s');
plant_1 = 1/(s*(s + 5)*(s + 7));
nyquistplot(plant_1)

image

Is there a limitation that might be causing this issue or am I missing something?

@bnavigator
Copy link
Contributor

Look at the y-axis scale. The nyquist plot from control cuts off at max_curve_magnitude and scales the "infinity" loop for display within the plot boundaries.
https://python-control.readthedocs.io/en/0.9.2/generated/control.nyquist_plot.html#control.nyquist_plot

@henklaak
Copy link
Contributor

henklaak commented Feb 2, 2023

Behaviour that will 'surprise' many, I guess. The documentation is not explicit about it and the default value of 20.

How about not drawing the large magnitudes at all? Just clip the traces at the limit with a ≫to indicate direction?

@murrayrm
Copy link
Member

murrayrm commented Feb 2, 2023

If you clip the traces, then it is harder to see the number of net encirclements. Especially if there is more than one. For example

sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])
ct.nyquist_plot(sys)

which generates:
multi-encirclement

@murrayrm
Copy link
Member

murrayrm commented Feb 2, 2023

We should definitely make sure all of this is well-documented, though.

@henklaak
Copy link
Contributor

henklaak commented Feb 3, 2023

I'll take a stab at this (the documenting part), expect PR.

@murrayrm murrayrm added this to the 0.9.4 milestone Mar 26, 2023
@murrayrm murrayrm self-assigned this Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants