Skip to content

Commit c3e199e

Browse files
committed
[nyquist_plot] Add arrow to indicate Nyquist orientation
1 parent 4ae2886 commit c3e199e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

control/freqplot.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,15 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None, labelFreq=0, *args,
395395
# Plot the primary curve and mirror image
396396
p = plt.plot(x, y, '-', color=color, *args, **kwargs)
397397
c = p[0].get_color()
398+
ax = plt.gca()
399+
# Plot arrow to indicate Nyquist encirclement orientation
400+
ax.arrow(x[0], y[0], (x[1]-x[0])/2, (y[1]-y[0])/2, fc=c, ec=c,
401+
head_width=0.2, head_length=0.2)
402+
398403
plt.plot(x, -y, '-', color=c, *args, **kwargs)
404+
ax.arrow(x[-1], -y[-1], (x[-1]-x[-2])/2, (y[-1]-y[-2])/2, fc=c, ec=c,
405+
head_width=0.2, head_length=0.2)
406+
399407
# Mark the -1 point
400408
plt.plot([-1], [0], 'r+')
401409

@@ -426,6 +434,7 @@ def nyquist_plot(syslist, omega=None, Plot=True, color=None, labelFreq=0, *args,
426434
ax = plt.gca()
427435
ax.set_xlabel("Real axis")
428436
ax.set_ylabel("Imaginary axis")
437+
ax.grid(color="lightgray")
429438

430439
return x, y, omega
431440

0 commit comments

Comments
 (0)