|
3 | 3 | # |
4 | 4 | # This file works through an LQR based design problem, using the |
5 | 5 | # planar vertical takeoff and landing (PVTOL) aircraft example from |
6 | | -# Astrom and Mruray, Chapter 5. It is intended to demonstrate the |
| 6 | +# Astrom and Murray, Chapter 5. It is intended to demonstrate the |
7 | 7 | # basic functionality of the python-control package. |
8 | 8 | # |
9 | 9 |
|
| 10 | +import os |
| 11 | + |
10 | 12 | from numpy import * # Grab all of the NumPy functions |
11 | 13 | from matplotlib.pyplot import * # Grab MATLAB plotting functions |
12 | 14 | from control.matlab import * # MATLAB-like functions |
|
118 | 120 | (Yy, Ty) = step(H1ay, T=linspace(0,10,100)); |
119 | 121 |
|
120 | 122 | subplot(221); title("Identity weights") |
121 | | -# plot(T, Y[:,1, 1], '-', T, Y[:,2, 2], '--'); hold(True); |
122 | | -plot(Tx.T, Yx.T, '-', Ty.T, Yy.T, '--'); hold(True); |
123 | | -plot([0, 10], [1, 1], 'k-'); hold(True); |
| 123 | +# plot(T, Y[:,1, 1], '-', T, Y[:,2, 2], '--'); |
| 124 | +plot(Tx.T, Yx.T, '-', Ty.T, Yy.T, '--'); |
| 125 | +plot([0, 10], [1, 1], 'k-'); |
124 | 126 |
|
125 | 127 | axis([0, 10, -0.1, 1.4]); |
126 | 128 | ylabel('position'); |
|
141 | 143 | [Y3, T3] = step(H1cx, T=linspace(0,10,100)); |
142 | 144 |
|
143 | 145 | subplot(222); title("Effect of input weights") |
144 | | -plot(T1.T, Y1.T, 'b-'); hold(True); |
145 | | -plot(T2.T, Y2.T, 'b-'); hold(True); |
146 | | -plot(T3.T, Y3.T, 'b-'); hold(True); |
147 | | -plot([0 ,10], [1, 1], 'k-'); hold(True); |
| 146 | +plot(T1.T, Y1.T, 'b-'); |
| 147 | +plot(T2.T, Y2.T, 'b-'); |
| 148 | +plot(T3.T, Y3.T, 'b-'); |
| 149 | +plot([0 ,10], [1, 1], 'k-'); |
148 | 150 |
|
149 | 151 | axis([0, 10, -0.1, 1.4]); |
150 | 152 |
|
|
190 | 192 | xlabel('time'); |
191 | 193 | legend(('x', 'y'), loc='lower right'); |
192 | 194 |
|
193 | | -show() |
| 195 | +if 'PYCONTROL_TEST_EXAMPLES' not in os.environ: |
| 196 | + show() |
| 197 | + |
0 commit comments