@@ -1477,8 +1477,8 @@ def nyquist_response(
1477
1477
1478
1478
def nyquist_plot (
1479
1479
data , omega = None , plot = None , label_freq = 0 , color = None , label = None ,
1480
- return_contour = None , title = None , legend_loc = 'upper right' ,
1481
- ax = None , ** kwargs ):
1480
+ return_contour = None , title = None , legend_loc = 'upper right' , ax = None ,
1481
+ unit_circle = False , mt_circles = None , ms_circles = None , ** kwargs ):
1482
1482
"""Nyquist plot for a system.
1483
1483
1484
1484
Generates a Nyquist plot for the system over a (optional) f
8000
requency
@@ -1501,7 +1501,13 @@ def nyquist_plot(
1501
1501
``omega_limits``.
1502
1502
color : string, optional
1503
1503
Used to specify the color of the line and arrowhead.
1504
-
1504
+ unit_circle : bool, optional
1505
+ If ``True``, display the unit circle, to read gain crossover frequency.
1506
+ mt_circles : array_like, optional
1507
+ Draws circles corresponding to the given magnitudes of sensitivity.
1508
+ ms_circles : array_like, optional
1509
+ Draws circles corresponding to the given magnitudes in complementary
1510
+ sensitivity.
1505
1511
**kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
1506
1512
Additional keywords (passed to `matplotlib`)
1507
1513
@@ -1856,6 +1862,27 @@ def _parse_linestyle(style_name, allow_false=False):
1856
1862
# Mark the -1 point
1857
1863
plt .plot ([- 1 ], [0 ], 'r+' )
1858
1864
1865
+ theta = np .linspace (0 , 2 * np .pi , 100 )
1866
+ cos = np .cos (theta )
1867
+ sin = np .sin (theta )
1868
+
1869
+ if unit_circle :
1870
+ plt .plot (cos , sin , color = "black" , linestyle = 'dashed' , linewidth = 1 )
1871
+
1872
+ if ms_circles is not None :
1873
+ for ms in ms_circles :
1874
+ plt .plot (- 1 + (1 / ms )* cos , (1 / ms )* sin , color = "black" , linestyle = "dashed" , linewidth = 1 )
1875
+
1876
+ if mt_circles is not None :
1877
+ for mt in mt_circles :
1878
+ if mt != 1 :
1879
+ ct = - mt ** 2 / (mt ** 2 - 1 ) # Mt center
1880
+ rt = mt / (mt ** 2 - 1 ) # Mt radius
1881
+ plt .plot (ct + rt * cos , rt * sin , color = "black" , linestyle = "dashed" , linewidth = 1 )
1882
+ else :
1883
+ _ , _ , ymin , ymax = plt .axis ()
1884
+ plt .vlines (- 0.5 , ymin = ymin , ymax = ymax , colors = "black" , linestyles = "dashed" , linewidth = 1 )
1885
+
1859
1886
# Label the frequencies of the points
1860
1887
if label_freq :
1861
1888
ind = slice (None , None , label_freq )
0 commit comments