Update Nyquist rescaling + other improvements by murrayrm · Pull Request #1155 · python-control/python-control
This PR addresses issue #1143 by changing the way that rescaling is handled in nyquist_plot. The prior code saturated the Nyquist curve at max_curve_magnitude, which would leave to confusing plots when the Nyquist curve had interesting features at large magnitude, since all of that detail was "collapsed" onto the limiting circle. In the new code, a 1-1 rescaling function is used that maps large magnitude features into a continuous range of magnitudes starting at a "blend point" and going out to max_curve_magnitude. The result is that the features of the Nyquist curve can be more easily visualized. The fraction of the Nyquist curve that is "blended" is set with a new parameter blend_fraction, that defaults to 0.20 (so the last 20% of the Nyquist curve prior to max_curve_magnitude is rescaled, with everything from the blend point to $\infty$ mapping from the blend point to max_curve_magnitude.
Using the example that @JonHowMIT raised in issue #1143, we go from this:
to this:
The original behavior can be retained by setting blend_fraction=0.
A few other changes that are also part of this PR:
- Updated
max_curve_magnitudefrom a default of 20 to 15 (this allows the -1 point to be see better). - Updated the default number of arrows from 2 to 3 (looked better in the gallery of plots available in
control/tests/nyquist_test. - Modified
control/tests/nyquist_testto generate a gallery of plots when run as a script (via python or ipython). - Changed the output of
nyquist_plotto match its documentation. In particular,cplt.lineswas returning a 1D array instead of a 2D array (as done in all other_plotfunctions). - Updated unit tests and examples.

