|
| 1 | +# Plotting Proposal |
| 2 | + |
| 3 | +## Review of Julia Control functions |
| 4 | + |
| 5 | +| Function | Purpose | |
| 6 | +|---|---| |
| 7 | +| `bode` | Compute the magnitude and phase of the frequency response |
| 8 | +| `bodeplot` | Create a Bode plot of the system |
| 9 | +| `freqresp` | Evaluate the frequency response of a linear system | |
| 10 | +| `gangoffourplot` | Gang-of-Four plot |
| 11 | +| `margin` | returns frequencies for gain margins, gain margins, frequencies for phase margins, phase margins |
| 12 | +| `marginplot` | Plot all the amplitude and phase margins of the system | |
| 13 | +| `nicholsplot` | Create a Nichols plot of the system | |
| 14 | +| `nyquist` | Compute the real and imaginary parts of the frequency response | |
| 15 | +| `nyquistplot` | Create a Nyquist plot of the system | |
| 16 | +| `pzmap` | Create a pole-zero map of the system | |
| 17 | +| `rlocus` | Computes and plots the root locus of the SISO LTISystem (deprecated) | |
| 18 | +| `rlocusplot` | Computes and plots the root locus of the SISO LTISystem | |
| 19 | +| `sigma` | Compute the singular values sv of the frequency response | |
| 20 | +| `sigmaplot` | Plot the singular values of the frequency response of the system | |
| 21 | + |
| 22 | +Correspondence table |
| 23 | + |
| 24 | +| Julia | Python-Control current | Proposal | |
| 25 | +|---|---|---| |
| 26 | +| `mag, phase, w = bode(sys)` | `mag, phase, w = bode_plot(sys, plot=False)` | `fr = freqresp(sys)` | |
| 27 | +| `fr = freqresp(sys, w)` | `mag, phase, w = control.matlab.freqresp(sys, w)` | `fr = freqresp(sys, w)` | |
| 28 | +| n/a | n/a | `fr.plot()` | |
| 29 | +| `bodeplot(sys)` | `bode_plot(sys)` | no change | |
| 30 | +| `fig = bodeplot(sys)` | n/a | `fig, axes = bode_plot(sys)` | |
| 31 | +| `gangoffourplot(P, C)` | `gangof4_plot(P, C)` | no change | |
| 32 | +| `fig = gangoffourplot(P, C)` | n/a | `fig, axes = gangof4_plot(P, C)` | |
| 33 | +| `ωgm, gm, ωpm, pm = margin(sys)` | `gm, pm, wg, wp = margin(sys)` | no change | |
| 34 | +| `marginplot(sys)` | n/a | no change for now | |
| 35 | +| `nicholsplot(sys)` | `nichols_plot(sys)` | no change | |
| 36 | +| `fig = nicholsplot(sys)` | n/a | `ax = nichols_plot(sys)` | |
| 37 | +| n/a | n/a | `nichols_plot(sys, ax=ax)` | |
| 38 | +| `re, im, w = nyquist(sys)` | n/a | no change for now | |
| 39 | +| `nyquistplot(sys)` | `nyquist_plot(sys)` | no change | |
| 40 | +| `fig = nyquistplot(sys)` | n/a | `ax = nyquist_plot(sys)` | |
| 41 | +| n/a | n/a | `nyquist_plot(sys, ax=ax)` | |
| 42 | +| `p, z = pole(sys), tzero(sys)` | `p, z = pzmap(sys, plot=False)` | `p, z = pole(sys), zero(sys)` | |
| 43 | +| `pzmap(sys)` | `pzmap(sys)` | no change | |
| 44 | +| `fig = pzmap(fig, sys)` | n/a | `ax = pzmap(sys)` | |
| 45 | +| n/a | n/a | `pzmap(sys, ax=ax)` | |
| 46 | +| n/a | `roots, k_out = root_locus(sys, plot=None)` | `roots, k_out = root_locus(sys)` | |
| 47 | +| `rlocusplot(sys)` | `root_locus(sys)` | `root_locus_plot(sys)` | |
| 48 | +| n/a | n/a | `ax = root_locus_plot(sys)` | |
| 49 | +| n/a | n/a | `root_locus_plot(sys, ax=ax)` | |
| 50 | +| `sv, w = sigma(sys)` | `sigma, w = singular_values_plot(sys, plot=False)` | `sigma, w = singular_values(sys)` | |
| 51 | +| `sigmaplot(sys)` | `singular_values_plot(sys)` | no change | |
| 52 | +| n/a | n/a | `ax = singular_values_plot(sys)` | |
| 53 | +| n/a | n/a | `singular_values_plot(ax=ax)` | |
| 54 | +| `y, t, x = step(sys)` | `T, yout = step_response(sys)` | `response = step_response(sys)`* | |
| 55 | +| `y, t, x = impulse(sys)` | `T, yout = impulse_response(sys)` | `response = impulse_response(sys)`* | |
| 56 | +| `y, t, x = lsim(sys, u, t)` | `T, yout = forced_response(sys, T, u)` | `response = forced_response(sys, T, u)`* | |
| 57 | +| `Plots.plot(t, y)` | `plt.plot(T, yout)` | `response.plot()`* | |
| 58 | +| n/a | n/a | `ax = response.plot()`* | |
| 59 | +| n/a | n/a | `response.plot(ax=ax)`* | |
| 60 | + |
| 61 | +\* - these changes are part of a different pull request by Richard. |
| 62 | + |
| 63 | + |
| 64 | +This will affect the following plotting functions |
| 65 | + |
| 66 | +* root_locus |
| 67 | +* pzmap |
| 68 | +* bode_plot |
| 69 | +* nyquist_plot |
| 70 | +* gangof4_plot |
| 71 | +* nichols_plot |
| 72 | +* sisotool |
| 73 | + |
| 74 | +## Idiom 1 - Quick plotting |
| 75 | + |
| 76 | +```python |
| 77 | +G1 = tf([2, 2], [1, 0, -1]) |
| 78 | +root_locus_plot(G1) # previously named root_locus |
| 79 | +``` |
| 80 | + |
| 81 | +```python |
| 82 | +G1 = tf([2, 2], [1, 0, -1]) |
| 83 | +root_locus_plot(G1) |
| 84 | +``` |
0 commit comments