Skip to content

Commit 136916b

Browse files
committed
[bode_plot] Compute nyquistfrq_plot only if plot is true
1 parent 3b4cd81 commit 136916b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

control/freqplot.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,6 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
167167
mag = np.atleast_1d(np.squeeze(mag_tmp))
168168
phase = np.atleast_1d(np.squeeze(phase_tmp))
169169
phase = unwrap(phase)
170-
nyquistfrq_plot = None
171-
if Hz:
172-
omega_plot = omega_sys / (2. * math.pi)
173-
if nyquistfrq:
174-
nyquistfrq_plot = nyquistfrq / (2. * math.pi)
175-
else:
176-
omega_plot = omega_sys
177-
if nyquistfrq:
178-
nyquistfrq_plot = nyquistfrq
179170

180171
mags.append(mag)
181172
phases.append(phase)
@@ -185,6 +176,16 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
185176
# TODO: Not current implemented; just use subplot for now
186177

187178
if Plot:
179+
nyquistfrq_plot = None
180+
if Hz:
181+
omega_plot = omega_sys / (2. * math.pi)
182+
if nyquistfrq:
183+
nyquistfrq_plot = nyquistfrq / (2. * math.pi)
184+
else:
185+
omega_plot = omega_sys
186+
if nyquistfrq:
187+
nyquistfrq_plot = nyquistfrq
188+
188189
# Set up the axes with labels so that multiple calls to
189190
# bode_plot will superimpose the data. This was implicit
190191
# before matplotlib 2.1, but changed after that (See

0 commit comments

Comments
 (0)