# Plotting Proposal ## Review of Julia Control functions | Function | Purpose | |---|---| | `bode` | Compute the magnitude and phase of the frequency response | `bodeplot` | Create a Bode plot of the system | `freqresp` | Evaluate the frequency response of a linear system | | `gangoffourplot` | Gang-of-Four plot | `margin` | returns frequencies for gain margins, gain margins, frequencies for phase margins, phase margins | `marginplot` | Plot all the amplitude and phase margins of the system | | `nicholsplot` | Create a Nichols plot of the system | | `nyquist` | Compute the real and imaginary parts of the frequency response | | `nyquistplot` | Create a Nyquist plot of the system | | `pzmap` | Create a pole-zero map of the system | | `rlocus` | Computes and plots the root locus of the SISO LTISystem (deprecated) | | `rlocusplot` | Computes and plots the root locus of the SISO LTISystem | | `sigma` | Compute the singular values sv of the frequency response | | `sigmaplot` | Plot the singular values of the frequency response of the system | Correspondence table | Julia | Python-Control current | Proposal | |---|---|---| | `mag, phase, w = bode(sys)` | `mag, phase, w = bode_plot(sys, plot=False)` | `fr = freqresp(sys)` | | `fr = freqresp(sys, w)` | `mag, phase, w = control.matlab.freqresp(sys, w)` | `fr = freqresp(sys, w)` | | n/a | n/a | `fr.plot()` | | `bodeplot(sys)` | `bode_plot(sys)` | no change | | `fig = bodeplot(sys)` | n/a | `fig, axes = bode_plot(sys)` | | `gangoffourplot(P, C)` | `gangof4_plot(P, C)` | no change | | `fig = gangoffourplot(P, C)` | n/a | `fig, axes = gangof4_plot(P, C)` | | `ωgm, gm, ωpm, pm = margin(sys)` | `gm, pm, wg, wp = margin(sys)` | no change | | `marginplot(sys)` | n/a | no change for now | | `nicholsplot(sys)` | `nichols_plot(sys)` | no change | | `fig = nicholsplot(sys)` | n/a | `ax = nichols_plot(sys)` | | n/a | n/a | `nichols_plot(sys, ax=ax)` | | `re, im, w = nyquist(sys)` | n/a | no change for now | | `nyquistplot(sys)` | `nyquist_plot(sys)` | no change | | `fig = nyquistplot(sys)` | n/a | `ax = nyquist_plot(sys)` | | n/a | n/a | `nyquist_plot(sys, ax=ax)` | | `p, z = pole(sys), tzero(sys)` | `p, z = pzmap(sys, plot=False)` | `p, z = pole(sys), zero(sys)` | | `pzmap(sys)` | `pzmap(sys)` | no change | | `fig = pzmap(fig, sys)` | n/a | `ax = pzmap(sys)` | | n/a | n/a | `pzmap(sys, ax=ax)` | | n/a | `roots, k_out = root_locus(sys, plot=None)` | `roots, k_out = root_locus(sys)` | | `rlocusplot(sys)` | `root_locus(sys)` | `root_locus_plot(sys)` | | n/a | n/a | `ax = root_locus_plot(sys)` | | n/a | n/a | `root_locus_plot(sys, ax=ax)` | | `sv, w = sigma(sys)` | `sigma, w = singular_values_plot(sys, plot=False)` | `sigma, w = singular_values(sys)` | | `sigmaplot(sys)` | `singular_values_plot(sys)` | no change | | n/a | n/a | `ax = singular_values_plot(sys)` | | n/a | n/a | `singular_values_plot(ax=ax)` | | `y, t, x = step(sys)` | `T, yout = step_response(sys)` | `response = step_response(sys)`* | | `y, t, x = impulse(sys)` | `T, yout = impulse_response(sys)` | `response = impulse_response(sys)`* | | `y, t, x = lsim(sys, u, t)` | `T, yout = forced_response(sys, T, u)` | `response = forced_response(sys, T, u)`* | | `Plots.plot(t, y)` | `plt.plot(T, yout)` | `response.plot()`* | | n/a | n/a | `ax = response.plot()`* | | n/a | n/a | `response.plot(ax=ax)`* | \* - these changes are part of a different pull request by Richard. This will affect the following plotting functions * root_locus * pzmap * bode_plot * nyquist_plot * gangof4_plot * nichols_plot * sisotool ## Idiom 1 - Quick plotting ```python G1 = tf([2, 2], [1, 0, -1]) root_locus_plot(G1) # previously named root_locus ``` ```python G1 = tf([2, 2], [1, 0, -1]) root_locus_plot(G1) ```