Skip to content

Commit 8273a7f

Browse files
committed
Merge branch 'KronosKoderS-master'
2 parents 00f6d5e + e42b973 commit 8273a7f

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ build.log
1212
.coverage
1313
doc/_build
1414
doc/generated
15-
16-
examples/.ipynb_checkpoints/
17-
.settings/org.eclipse.core.resources.prefs
18-
.pydevproject
19-
.project
15+
examples/.ipynb_checkpoints/
16+
.settings/org.eclipse.core.resources.prefs
17+
.pydevproject
18+
.project
2019
Untitled*.ipynb
20+
*.idea/

control/matlab/timeresp.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
__all__ = ['step', 'impulse', 'initial', 'lsim']
88

9-
def step(sys, T=None, X0=0., input=0, output=None):
9+
def step(sys, T=None, X0=0., input=0, output=None, return_x=False):
1010
'''
1111
Step response of a linear system
1212
@@ -40,9 +40,14 @@ def step(sys, T=None, X0=0., input=0, output=None):
4040
yout: array
4141
Response of the system
4242
43+
xout: array (if selected)
44+
Individual response of each x variable
45+
4346
T: array
4447
Time values of the output
4548
49+
50+
4651
See Also
4752
--------
4853
lsim, initial, impulse
@@ -52,8 +57,14 @@ def step(sys, T=None, X0=0., input=0, output=None):
5257
>>> yout, T = step(sys, T, X0)
5358
'''
5459
from ..timeresp import step_response
55-
T, yout = step_response(sys, T, X0, input, output,
56-
transpose = True)
60+
61+
62+
T, yout, xout = step_response(sys, T, X0, input, output,
63+
transpose = True, return_x=return_x)
64+
65+
if return_x:
66+
return yout, xout, T
67+
5768
return yout, T
5869

5970
def impulse(sys, T=None, input=0, output=None):

control/timeresp.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def _get_ss_simo(sys, input=None, output=None):
417417
return _mimo2siso(sys_ss, input, output, warn_conversion=warn)
418418

419419
def step_response(sys, T=None, X0=0., input=None, output=None,
420-
transpose=False):
420+
transpose=False, return_x=False):
421421
# pylint: disable=W0622
422422
"""Step response of a linear system
423423
@@ -461,6 +461,9 @@ def step_response(sys, T=None, X0=0., input=None, output=None,
461461
yout: array
462462
Response of the system
463463
464+
xout: array
465+
Individual response of each x variable
466+
464467
See Also
465468
--------
466469
forced_response, initial_response, impulse_response
@@ -480,9 +483,12 @@ def step_response(sys, T=None, X0=0., input=None, output=None,
480483

481484
U = np.ones_like(T)
482485

483-
T, yout, _xout = forced_response(sys, T, U, X0,
486+
T, yout, xout = forced_response(sys, T, U, X0,
484487
transpose=transpose)
485488

489+
if return_x:
490+
return T, yout, xout
491+
486492
return T, yout
487493

488494

0 commit comments

Comments
 (0)