@@ -1492,7 +1492,7 @@ def nyquist_response(
14921492
14931493def nyquist_plot (
14941494 data , omega = None , plot = None , label_freq = 0 , color = None ,
1495- return_contour = None , title = None , legend_loc = 'upper right' , ** kwargs ):
1495+ return_contour = None , title = None , legend_loc = 'upper right' , unit_circle = False , mt_circles = None , ms_circles = None , ** kwargs ):
14961496 """Nyquist plot for a system.
14971497
14981498 Generates a Nyquist plot for the system over a (optional) frequency
@@ -1527,6 +1527,15 @@ def nyquist_plot(
15271527 return_contour : bool, optional
15281528 If 'True', return the contour used to evaluate the Nyquist plot.
15291529
1530+ unit_circle : bool, optional
1531+ If 'True', displays the unit circle, to read gain crossover frequency.
1532+
1533+ mt_circles : array_like, optional
1534+ draws circles corresponding to the given magnitudes of sensitivity
1535+
1536+ ms_circles : array_like, optional
1537+ draws circles corresponding to the given magnitudes in complementary sensitivity
1538+
15301539 **kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
15311540 Additional keywords (passed to `matplotlib`)
15321541
@@ -1862,6 +1871,27 @@ def _parse_linestyle(style_name, allow_false=False):
18621871 # Mark the -1 point
18631872 plt .plot ([- 1 ], [0 ], 'r+' )
18641873
1874+ theta = np .linspace (0 , 2 * np .pi , 100 )
1875+ cos = np .cos (theta )
1876+ sin = np .sin (theta )
1877+
1878+ if unit_circle :
1879+ plt .plot (cos , sin , color = "black" , linestyle = 'dashed' , linewidth = 1 )
1880+
1881+ if ms_circles is not None :
1882+ for ms in ms_circles :
1883+ plt .plot (- 1 + (1 / ms )* cos , (1 / ms )* sin , color = "black" , linestyle = "dashed" , linewidth = 1 )
1884+
1885+ if mt_circles is not None :
1886+ for mt in mt_circles :
1887+ if mt != 1 :
1888+ ct = - mt ** 2 / (mt ** 2 - 1 ) # Mt center
1889+ rt = mt / (mt ** 2 - 1 ) # Mt radius
1890+ plt .plot (ct + rt * cos , rt * sin , color = "black" , linestyle = "dashed" , linewidth = 1 )
1891+ else :
1892+ _ , _ , ymin , ymax = plt .axis ()
1893+ plt .vlines (- 0.5 , ymin = ymin , ymax = ymax , colors = "black" , linestyles = "dashed" , linewidth = 1 )
1894+
18651895 # Label the frequencies of the points
18661896 if label_freq :
18671897 ind = slice (None , None , label_freq )
0 commit comments