Skip to content

Commit 681edb7

Browse files
committed
FIX:
- added default settings for singular_values_plot
1 parent 14ef194 commit 681edb7

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

control/freqplot.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,15 @@ def gangof4_plot(P, C, omega=None, **kwargs):
10451045
#
10461046

10471047

1048+
# Default values for Bode plot configuration variables
1049+
_singular_values_plot_default = {
1050+
'singular_values_plot.dB': False, # Plot singular values in dB
1051+
'singular_values_plot.deg': True, # Plot phase in degrees
1052+
'singular_values_plot.Hz': False, # Plot frequency in Hertz
1053+
'singular_values_plot.grid': True, # Turn on grid for gain and phase
1054+
}
1055+
1056+
10481057
def singular_values_plot(syslist, omega=None,
10491058
plot=True, omega_limits=None, omega_num=None,
10501059
*args, **kwargs):
@@ -1078,7 +1087,7 @@ def singular_values_plot(syslist, omega=None,
10781087
----------------
10791088
grid : bool
10801089
If True, plot grid lines on gain and phase plots. Default is set by
1081-
`config.defaults['bode.grid']`.
1090+
`config.defaults['singular_values_plot.grid']`.
10821091
10831092
Examples
10841093
--------
@@ -1092,10 +1101,10 @@ def singular_values_plot(syslist, omega=None,
10921101
kwargs = dict(kwargs)
10931102

10941103
# Get values for params (and pop from list to allow keyword use in plot)
1095-
dB = config._get_param('bode', 'dB', kwargs, _bode_defaults, pop=True)
1096-
Hz = config._get_param('bode', 'Hz', kwargs, _bode_defaults, pop=True)
1097-
grid = config._get_param('bode', 'grid', kwargs, _bode_defaults, pop=True)
1098-
plot = config._get_param('bode', 'grid', plot, True)
1104+
dB = config._get_param('singular_values_plot', 'dB', kwargs, singular_values_plot, pop=True)
1105+
Hz = config._get_param('singular_values_plot', 'Hz', kwargs, _bode_defaults, pop=True)
1106+
grid = config._get_param('singular_values_plot', 'grid', kwargs, _bode_defaults, pop=True)
1107+
plot = config._get_param('singular_values_plot', 'grid', plot, True)
10991108

11001109
# If argument was a singleton, turn it into a tuple
11011110
if not hasattr(syslist, '__iter__'):
@@ -1182,7 +1191,7 @@ def singular_values_plot(syslist, omega=None,
11821191

11831192
# Add a grid to the plot + labeling
11841193
ax_sigma.grid(grid, which='both')
1185-
ax_sigma.set_ylabel("Magnitude (dB)" if dB else "Magnitude")
1194+
ax_sigma.set_ylabel("Singular Values (dB)" if dB else "Singular Values")
11861195
ax_sigma.set_xlabel("Frequency (Hz)" if Hz else "Frequency (rad/sec)")
11871196

11881197
if len(syslist) == 1:

0 commit comments

Comments
 (0)