Skip to content

Commit 46b3c53

Browse files
authored
Merge pull request #722 from murrayrm/nyquist_bug_09Apr2022
Bug fix and improvements to Nyquist plots
2 parents 2102181 + 7407265 commit 46b3c53

File tree

7 files changed

+578
-126
lines changed

7 files changed

+578
-126
lines changed

control/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ def use_legacy_defaults(version):
267267
#
268268
reset_defaults() # start from a clean slate
269269

270+
# Version 0.9.2:
271+
if major == 0 and minor < 9 or (minor == 9 and patch < 2):
272+
from math import inf
273+
274+
# Reset Nyquist defaults
275+
set_defaults('nyquist', indent_radius=0.1, max_curve_magnitude=inf,
276+
max_curve_offset=0, primary_style=['-', '-'],
277+
mirror_style=['--', '--'], start_marker_size=0)
278+
270279
# Version 0.9.0:
271280
if major == 0 and minor < 9:
272281
# switched to 'array' as default for state space objects

control/descfcn.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ def describing_function(
199199

200200

201201
def describing_function_plot(
202-
H, F, A, omega=None, refine=True, label="%5.2g @ %-5.2g", **kwargs):
202+
H, F, A, omega=None, refine=True, label="%5.2g @ %-5.2g",
203+
warn=None, **kwargs):
203204
"""Plot a Nyquist plot with a describing function for a nonlinear system.
204205
205206
This function generates a Nyquist plot for a closed loop system consisting
@@ -220,6 +221,10 @@ def describing_function_plot(
220221
label : str, optional
221222
Formatting string used to label intersection points on the Nyquist
222223
plot. Defaults to "%5.2g @ %-5.2g". Set to `None` to omit labels.
224+
warn : bool, optional
225+
Set to True to turn on warnings generated by `nyquist_plot` or False
226+
to turn off warnings. If not set (or set to None), warnings are
227+
turned off if omega is specified, otherwise they are turned on.
223228
224229
Returns
225230
-------
@@ -240,9 +245,15 @@ def describing_function_plot(
240245
[(3.344008947853124, 1.414213099755523)]
241246
242247
"""
248+
# Decide whether to turn on warnings or not
249+
if warn is None:
250+
# Turn warnings on unless omega was specified
251+
warn = omega is None
252+
243253
# Start by drawing a Nyquist curve
244254
count, contour = nyquist_plot(
245-
H, omega, plot=True, return_contour=True, **kwargs)
255+
H, omega, plot=True, return_contour=True,
256+
warn_encirclements=warn, warn_nyquist=warn, **kwargs)
246257
H_omega, H_vals = contour.imag, H(contour)
247258

248259
# Compute the describing function

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy