Round to nearest integer decade for default omega vector by bnavigator · Pull Request #688 · python-control/python-control
Fixes #687.
The docstring for the _default_frequency_range() function says
This code looks at the poles and zeros of all of the systems that
we are plotting and sets the frequency range to be one decade above
and below the min and max feature frequencies, rounded to the nearest
integer.
The old code rounded to the floor and ceiling of the range, which occasionally adds another decade to one or the other end of the frequency range if the feature falls just inside of the outermost decade.
The new code rounds to the nearest integer, so it only adds half a decade at minimum.
bnavigator
changed the title
Round to nearest integer for default omega vector
Round to nearest integer decade for default omega vector
Looking at the coveralls report, it turns out the Hz parameter was never passed through to _default_frequency_range(). Fixed now.
From the sisotool test which had to be changed:
from numpy import array from matplotlib import pyplot as plt from control import TransferFunction, bode_plot tsys = TransferFunction(array([1000]), array([ 1, 25, 100, 0])) # poles: [-20., -5., 0.] for Hz in [True, False]: plt.figure() bode_plot(tsys, Hz=Hz)
| Hz | False | True |
|---|---|---|
| Before | ![]() |
![]() |
| After | ![]() |
![]() |
@bnavigator In thinking through this overnight, I wonder if we might want to revert to the old behavior (floor, ceil) and update the documentation to match (+ update the unit tests to avoid the corner case). I'm worried that only going out a half decade might now show the asymptotic frequency response. I'll work up a couple of examples and post an issue so that we can discuss.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters



