Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use Hz=False for MATLAB + docstring corrections
  • Loading branch information
murrayrm committed Mar 21, 2020
commit 249d85e854e76c40e8b0cafdc4a6a4108ae7dcce
6 changes: 3 additions & 3 deletions control/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ def use_matlab_defaults():

The following conventions are used:
* Bode plots plot gain in dB, phase in degrees, frequency in
Hertz, with grids
rad/sec, with grids
* State space class and functions use Numpy matrix objects

"""
set_defaults('bode', dB=True, deg=True, Hz=True, grid=True)
set_defaults('bode', dB=True, deg=True, Hz=False, grid=True)
set_defaults('statesp', use_numpy_matrix=True)


Expand All @@ -128,7 +128,7 @@ def use_fbs_defaults():

The following conventions are used:
* Bode plots plot gain in powers of ten, phase in degrees,
frequency in Hertz, no grid
frequency in rad/sec, no grid

"""
set_defaults('bode', dB=False, deg=True, Hz=False, grid=False)
Expand Down
8 changes: 4 additions & 4 deletions control/tests/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def test_matlab_bode(self):
mag_data = mag_line[0].get_data()
mag_x, mag_y = mag_data

# Make sure the x-axis is in Hertz and y-axis is in dB
np.testing.assert_almost_equal(mag_x[0], 0.001 / (2*pi), decimal=6)
# Make sure the x-axis is in rad/sec and y-axis is in dB
np.testing.assert_almost_equal(mag_x[0], 0.001, decimal=6)
np.testing.assert_almost_equal(mag_y[0], 20*log10(10), decimal=3)

# Get the phase line
Expand All @@ -117,8 +117,8 @@ def test_matlab_bode(self):
phase_data = phase_line[0].get_data()
phase_x, phase_y = phase_data

# Make sure the x-axis is in Hertz and y-axis is in degrees
np.testing.assert_almost_equal(phase_x[-1], 1000 / (2*pi), decimal=1)
# Make sure the x-axis is in rad/sec and y-axis is in degrees
np.testing.assert_almost_equal(phase_x[-1], 1000, decimal=1)
np.testing.assert_almost_equal(phase_y[-1], -180, decimal=0)

# Override the defaults and make sure that works as well
Expand Down