Skip to content

Commit a878846

Browse files
committed
include yfinal in matlab.stepinfo call signature
1 parent 6587f69 commit a878846

File tree

2 files changed

+49
-26
lines changed

2 files changed

+49
-26
lines changed

control/matlab/timeresp.py

+46-23
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,59 @@ def step(sys, T=None, X0=0., input=0, output=None, return_x=False):
6464
transpose=True, return_x=return_x)
6565
return (out[1], out[0], out[2]) if return_x else (out[1], out[0])
6666

67-
def stepinfo(sys, T=None, SettlingTimeThreshold=0.02,
67+
68+
def stepinfo(sysdata, T=None, yfinal=None, SettlingTimeThreshold=0.02,
6869
RiseTimeLimits=(0.1, 0.9)):
69-
'''
70+
"""
7071
Step response characteristics (Rise time, Settling Time, Peak and others).
7172
7273
Parameters
7374
----------
74-
sys: StateSpace, or TransferFunction
75-
LTI system to simulate
76-
77-
T: array-like or number, optional
75+
sysdata : StateSpace or TransferFunction or array_like
76+
The system data. Either LTI system to similate (StateSpace,
77+
TransferFunction), or a time series of step response data.
78+
T : array_like or float, optional
7879
Time vector, or simulation time duration if a number (time vector is
79-
autocomputed if not given)
80-
81-
SettlingTimeThreshold: float value, optional
80+
autocomputed if not given).
81+
Required, if sysdata is a time series of response data.
82+
yfinal : scalar or array_like, optional
83+
Steady-state response. If not given, sysdata.dcgain() is used for
84+
systems to simulate and the last value of the the response data is
85+
used for a given time series of response data. Scalar for SISO,
86+
(noutputs, ninputs) array_like for MIMO systems.
87+
SettlingTimeThreshold : float, optional
8288
Defines the error to compute settling time (default = 0.02)
83-
84-
RiseTimeLimits: tuple (lower_threshold, upper_theshold)
89+
RiseTimeLimits : tuple (lower_threshold, upper_theshold)
8590
Defines the lower and upper threshold for RiseTime computation
8691
8792
Returns
8893
-------
89-
S: a dictionary containing:
90-
RiseTime: Time from 10% to 90% of the steady-state value.
91-
SettlingTime: Time to enter inside a default error of 2%
92-
SettlingMin: Minimum value after RiseTime
93-
SettlingMax: Maximum value after RiseTime
94-
Overshoot: Percentage of the Peak relative to steady value
95-
Undershoot: Percentage of undershoot
96-
Peak: Absolute peak value
97-
PeakTime: time of the Peak
98-
SteadyStateValue: Steady-state value
94+
S : dict or list of list of dict
95+
If `sysdata` corresponds to a SISO system, S is a dictionary
96+
containing:
97+
98+
RiseTime:
99+
Time from 10% to 90% of the steady-state value.
100+
SettlingTime:
101+
Time to enter inside a default error of 2%
102+
SettlingMin:
103+
Minimum value after RiseTime
104+
SettlingMax:
105+
Maximum value after RiseTime
106+
Overshoot:
107+
Percentage of the Peak relative to steady value
108+
Undershoot:
109+
Percentage of undershoot
110+
Peak:
111+
Absolute peak value
112+
PeakTime:
113+
time of the Peak
114+
SteadyStateValue:
115+
Steady-state value
116+
117+
If `sysdata` corresponds to a MIMO system, `S` is a 2D list of dicts.
118+
To get the step response characteristics from the j-th input to the
119+
i-th output, access ``S[i][j]``
99120
100121
101122
See Also
@@ -105,11 +126,13 @@ def stepinfo(sys, T=None, SettlingTimeThreshold=0.02,
105126
Examples
106127
--------
107128
>>> S = stepinfo(sys, T)
108-
'''
129+
"""
109130
from ..timeresp import step_info
110131

111132
# Call step_info with MATLAB defaults
112-
S = step_info(sys, T, None, SettlingTimeThreshold, RiseTimeLimits)
133+
S = step_info(sysdata, T=T, T_num=None, yfinal=yfinal,
134+
SettlingTimeThreshold=SettlingTimeThreshold,
135+
RiseTimeLimits=RiseTimeLimits)
113136

114137
return S
115138

control/timeresp.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -746,18 +746,18 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
746746
TransferFunction), or a time series of step response data.
747747
T : array_like or float, optional
748748
Time vector, or simulation time duration if a number (time vector is
749-
autocomputed if not given, see :func:`step_response` for more detail)
749+
autocomputed if not given, see :func:`step_response` for more detail).
750750
Required, if sysdata is a time series of response data.
751751
T_num : int, optional
752752
Number of time steps to use in simulation if T is not provided as an
753753
array; autocomputed if not given; ignored if sysdata is a
754754
discrete-time system or a time series or response data.
755-
yfinal: scalar or array_like, optional
755+
yfinal : scalar or array_like, optional
756756
Steady-state response. If not given, sysdata.dcgain() is used for
757757
systems to simulate and the last value of the the response data is
758758
used for a given time series of response data. Scalar for SISO,
759759
(noutputs, ninputs) array_like for MIMO systems.
760-
SettlingTimeThreshold : float value, optional
760+
SettlingTimeThreshold : float, optional
761761
Defines the error to compute settling time (default = 0.02)
762762
RiseTimeLimits : tuple (lower_threshold, upper_theshold)
763763
Defines the lower and upper threshold for RiseTime computation

0 commit comments

Comments
 (0)