Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions control/freqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ def gen_zero_centered_series(val_min, val_max, period):
# Nyquist plot
#

def nyquist_plot(syslist, omega=None, Plot=True, color=None,
labelFreq=0, *args, **kwargs):
def nyquist_plot(syslist, omega=None, Plot=True,
labelFreq=0, arrowhead_length=0.1, arrowhead_width=0.1,
color=None, *args, **kwargs):
"""
Nyquist plot for a system

Expand All @@ -452,6 +453,8 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
Used to specify the color of the plot
labelFreq : int
Label every nth frequency on the plot
arrowhead_width : arrow head width
arrowhead_length : arrow head length
*args
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
**kwargs:
Expand Down Expand Up @@ -511,12 +514,14 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None,
ax = plt.gca()
# Plot arrow to indicate Nyquist encirclement orientation
ax.arrow(x[0], y[0], (x[1]-x[0])/2, (y[1]-y[0])/2, fc=c, ec=c,
head_width=0.2, head_length=0.2)
head_width=arrowhead_width,
head_length=arrowhead_length)

plt.plot(x, -y, '-', color=c, *args, **kwargs)
ax.arrow(
x[-1], -y[-1], (x[-1]-x[-2])/2, (y[-1]-y[-2])/2,
fc=c, ec=c, head_width=0.2, head_length=0.2)
fc=c, ec=c, head_width=arrowhead_width,
head_length=arrowhead_length)

# Mark the -1 point
plt.plot([-1], [0], 'r+')
Expand Down