Skip to content

Commit c63dee8

Browse files
committed
Added Eike's Welk's time response functions, including MIMO
capability. To maintain MATLAB compatibility, the underlying functions have been moved to a new module, timeresp, and renamed ForcedResponse (lsim), InitialResponse (initial), ImpulseResponse (impulse), StepResponse (step). MATLAB version of the functions (with the usual names: lsim, impulse, initial, step) use MATLAB conventions for time vectors. See ChangeLog for detailed list of changes.
1 parent edfd8ce commit c63dee8

12 files changed

+1810
-340
lines changed

ChangeLog

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
1+
2011-06-18 Richard Murray <murray@malabar.local>
2+
3+
* src/timeresp.py, src/matlab.py: moved documentation about time
4+
series convention from matlab.py to timeresp.py
5+
6+
* examples/pvtol-nested-ss.py: Fixed bug in call to step (wrong
7+
second argument)
8+
9+
* tests/matlab_test.py: Updated tests to use MATLAB time response
10+
conventions.
11+
12+
* tests/timeresp_test.py: Created unit tests for timeresp module,
13+
based on matlab_test.py
14+
15+
2011-06-17 Richard Murray <murray@malabar.local>
16+
17+
* src/timeresp.py (ForcedResponse): swapped order of input and time
18+
arguments for linear response, following Eike's comment "T must
19+
always be supplied by the user, but U has a useful default value of
20+
0."
21+
22+
* src/matlab.py: moved code for lsim, initial, step, and impulse to
23+
timeresp.py and put in new routes that call timeresp.* versions of
24+
the functions with transposeData set to True.
25+
26+
* src/timesim.py (_check_convert_array): added transpose argument
27+
that will transpose input data before processing it.
28+
29+
* src/timesim.py: renamed lsim, initial, step, and impulse functions
30+
to ForcedResponse, InitialResponse, StepResponse and
31+
ImpulseResponse. These versions use Eike Welk's input ordering.
32+
33+
* examples/pvtol-nested.py: calls to step() had screwed up inputs.
34+
Fixed.
35+
36+
2011-06-17 Richard Murray <murray@malabar.local>
37+
38+
* src/matlab.py: added MIMO extensions from Eike Welk on 12 Jun
39+
2011: adds MIMO capabilities for ``lsim``, ``step``, ``impulse``,
40+
``initial``
41+
42+
* src/matlab.py: added changes from Eike Welk on 12 May 2011:
43+
44+
- An implementation of the four simulation functions ``lsim``,
45+
``step``, ``initial``, and ``impulse`` of the module ``matlab``.
46+
47+
- Adds a function ``dcgain`` to the ``matlab`` module, which
48+
computes the gain of a linear system for steady state and
49+
constant input.
50+
51+
- The patch contains a bug fix for class ``StateSpace``, which
52+
enables it to work properly together with Scipy's ``signal``
53+
module.
54+
55+
- The simulation functions' return values are changed (back?) to
56+
arrays, because matrices confuse Matplotlib.
57+
58+
- New times series convention: see _time-series-convention section
59+
of matlab documentation
60+
61+
- SISO simulation data are squeezed on output. To turn this off,
62+
pass the option squeeze=False
63+
164
---- control-0.4c released -----
265

366
2011-06-17 Richard Murray <murray@dhcp096.fhl.washington.edu>

doc/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
# Add any Sphinx extension module names here, as strings. They can be extensions
2828
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
29-
extensions = ['sphinx.ext.autodoc','numpydoc']
29+
extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.pngmath',
30+
'sphinx.ext.intersphinx']
3031

3132
# Add any paths that contain templates here, relative to this directory.
3233
templates_path = ['_templates']
@@ -87,6 +88,10 @@
8788
# A list of ignored prefixes for module index sorting.
8889
#modindex_common_prefix = []
8990

91+
#This config value contains the locations and names of other projects that
92+
#should be linked to in this documentation.
93+
intersphinx_mapping = {'scipy':('http://docs.scipy.org/doc/scipy/reference/', None)}
94+
9095

9196
# -- Options for HTML output ---------------------------------------------------
9297

examples/pvtol-lqr.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
subplot(221); title("Identity weights")
121121
# plot(T, Y[:,1, 1], '-', T, Y[:,2, 2], '--'); hold(True);
122-
plot(Tx.T, Yx[0,:].T, '-', Ty.T, Yy[0,:].T, '--'); hold(True);
122+
plot(Tx.T, Yx.T, '-', Ty.T, Yy.T, '--'); hold(True);
123123
plot([0, 10], [1, 1], 'k-'); hold(True);
124124

125125
axis([0, 10, -0.1, 1.4]);
@@ -141,9 +141,9 @@
141141
[T3, Y3] = step(H1cx, T=linspace(0,10,100));
142142

143143
subplot(222); title("Effect of input weights")
144-
plot(T1.T, Y1[0,:].T, 'b-'); hold(True);
145-
plot(T2.T, Y2[0,:].T, 'b-'); hold(True);
146-
plot(T3.T, Y3[0,:].T, 'b-'); hold(True);
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);
147147
plot([0 ,10], [1, 1], 'k-'); hold(True);
148148

149149
axis([0, 10, -0.1, 1.4]);
@@ -162,7 +162,7 @@
162162
subplot(223); title("Output weighting")
163163
[T2x, Y2x] = step(H2x, T=linspace(0,10,100));
164164
[T2y, Y2y] = step(H2y, T=linspace(0,10,100));
165-
plot(T2x.T, Y2x[0,:].T, T2y.T, Y2y[0,:].T)
165+
plot(T2x.T, Y2x.T, T2y.T, Y2y.T)
166166
ylabel('position');
167167
xlabel('time'); ylabel('position');
168168
legend(('x', 'y'), loc='lower right');
@@ -185,7 +185,7 @@
185185
# step(H3x, H3y, 10);
186186
[T3x, Y3x] = step(H3x, T=linspace(0,10,100));
187187
[T3y, Y3y] = step(H3y, T=linspace(0,10,100));
188-
plot(T3x.T, Y3x[0,:].T, T3y.T, Y3y[0,:].T)
188+
plot(T3x.T, Y3x.T, T3y.T, Y3y.T)
189189
title("Physically motivated weights")
190190
xlabel('time');
191191
legend(('x', 'y'), loc='lower right');

examples/pvtol-nested-ss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
# 'EdgeColor', color, 'FaceColor', color);
145145

146146
figure(9);
147-
(Tvec, Yvec) = step(T, None, linspace(1, 20));
147+
(Tvec, Yvec) = step(T, linspace(1, 20));
148148
plot(Tvec.T, Yvec.T); hold(True);
149149

150-
(Tvec, Yvec) = step(Co*S, None, linspace(1, 20));
150+
(Tvec, Yvec) = step(Co*S, linspace(1, 20));
151151
plot(Tvec.T, Yvec.T);
152152

153153
#TODO: PZmap for statespace systems has not yet been implemented.

examples/pvtol-nested.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@
134134
# 'EdgeColor', color, 'FaceColor', color);
135135

136136
figure(9);
137-
(Tvec, Yvec) = step(T, None, linspace(1, 20));
137+
(Tvec, Yvec) = step(T, linspace(1, 20));
138138
plot(Tvec.T, Yvec.T); hold(True);
139139

140-
(Tvec, Yvec) = step(Co*S, None, linspace(1, 20));
140+
(Tvec, Yvec) = step(Co*S, linspace(1, 20));
141141
plot(Tvec.T, Yvec.T);
142142

143143
figure(10); clf();

src/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@
6666
from modelsimp import *
6767
from rlocus import *
6868
from mateqn import *
69+
from timeresp import ForcedResponse, InitialResponse, StepResponse, \
70+
ImpulseResponse

0 commit comments

Comments
 (0)