Skip to content

Refine automatic contour determination in Nyquist plot #620

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

Merged
merged 5 commits into from
Jun 16, 2021

Conversation

bnavigator
Copy link
Contributor

Fix for #613

import control
import matplotlib.pyplot as plt

G =  control.tf([1], [1,1,0,0,0])

count, contour1 = control.nyquist_plot(G, label='indent_radius default (0.1)',
                     return_contour=True)

R = 0.11
count, contour2 = control.nyquist_plot(G, indent_radius=R,
                                      return_contour=True,
                                      label=f'indent_radius={R}')

ax = plt.gca()
ax.set_aspect(1)
ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)

plt.figure()
cp = plt.plot(contour1.real, contour1.imag, '-',
              label='indent_radius default (0.1)')
c = cp[0].get_color()
plt.plot(contour1.real, -contour1.imag, '--', color=c)
cp = plt.plot(contour2.real, contour2.imag, '-',
              label=f'indent_radius={R}')
c = cp[0].get_color()
plt.plot(contour2.real, -contour2.imag, '--', color=c)
ax = plt.gca()
ax.legend()
ax.set_aspect(1)
ax.set_xlim([-0.2, 0.2])
ax.set_ylim([-0.2, 0.2])
ax.grid()
ax.set_title(r'Nyquist Contour $\Gamma$',)
plt.show()

Figure_1
Figure_2

@coveralls
Copy link

coveralls commented May 1, 2021

Coverage Status

Coverage increased (+0.01%) to 89.641% when pulling 5cf0358 on bnavigator:freqplot-omega into 9f27293 on python-control:master.

@josujugo
Copy link

josujugo commented May 1, 2021

Hi,

I am trying to replicate this code in the master version and I am getting different plots. What am I doing wrong?

download-3

download-2

@bnavigator
Copy link
Contributor Author

The master branch does not have the changed code. You have to checkout the PR brach.

@josujugo
Copy link

josujugo commented May 1, 2021

Ok, thanks. I have misunderstood it.

@murrayrm murrayrm merged commit 618ea45 into python-control:master Jun 16, 2021
@murrayrm murrayrm added this to the 0.9.1 milestone Dec 30, 2021
@bnavigator bnavigator deleted the freqplot-omega branch February 18, 2024 20:30
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 this pull request may close these issues.

Nyquist plot with imaginary poles, semi-circles only working after 'trick'
4 participants