Skip to content

Fix issue #309: examples/pvtol-nested-ss.py plotting #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion control/freqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def bode_plot(syslist, omega=None,
If True, plot phase in degrees (else radians). Default value (True)
config.defaults['bode.deg']
Plot : bool
If True, plot magnitude and phase
If True (default), plot magnitude and phase
omega_limits: tuple, list, ... of two values
Limits of the to generate frequency vector.
If Hz=True the limits are in Hz otherwise in rad/s.
Expand Down
19 changes: 11 additions & 8 deletions examples/pvtol-nested-ss.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,24 @@

plt.figure(6)
plt.clf()
plt.subplot(221)
bode(L, logspace(-4, 3))

# Add crossover line
plt.subplot(211)
plt.loglog([1e-4, 1e3], [1, 1], 'k-')
# Add crossover line to magnitude plot
for ax in plt.gcf().axes:
if ax.get_label() == 'control-bode-magnitude':
break
ax.semilogx([1e-4, 1e3], 20*np.log10([1, 1]), 'k-')

# Re-plot phase starting at -90 degrees
mag, phase, w = freqresp(L, logspace(-4, 3))
phase = phase - 360

plt.subplot(212)
plt.semilogx([1e-4, 1e3], [-180, -180], 'k-')
plt.semilogx(w, np.squeeze(phase), 'b-')
plt.axis([1e-4, 1e3, -360, 0])
for ax in plt.gcf().axes:
if ax.get_label() == 'control-bode-phase':
break
ax.semilogx([1e-4, 1e3], [-180, -180], 'k-')
ax.semilogx(w, np.squeeze(phase), 'b-')
ax.axis([1e-4, 1e3, -360, 0])
plt.xlabel('Frequency [deg]')
plt.ylabel('Phase [deg]')
# plt.set(gca, 'YTick', [-360, -270, -180, -90, 0])
Expand Down