diff --git a/control/iosys.py b/control/iosys.py index 895e04015..16ef633b7 100644 --- a/control/iosys.py +++ b/control/iosys.py @@ -855,7 +855,7 @@ def __call__(sys, u, params=None, squeeze=None): # Evaluate the function on the argument out = sys._out(0, np.array((0,)), np.asarray(u)) - _, out = _process_time_response(sys, [], out, [], squeeze=squeeze) + _, out = _process_time_response(sys, None, out, None, squeeze=squeeze) return out def _update_params(self, params, warning=False): @@ -1867,8 +1867,10 @@ def linearize(sys, xeq, ueq=[], t=0, params={}, **kw): # Utility function to parse a signal parameter def _parse_signal_parameter(value, name, kwargs, end=False): + # Check kwargs for a variant of the parameter name if value is None and name in kwargs: - value = list(kwargs.pop(name)) + value = kwargs.pop(name) + if end and kwargs: raise TypeError("unknown parameters %s" % kwargs) return value diff --git a/control/timeresp.py b/control/timeresp.py index 55ced8302..9ccf24bf3 100644 --- a/control/timeresp.py +++ b/control/timeresp.py @@ -467,8 +467,11 @@ def _process_time_response( Parameters ---------- + sys : LTI or InputOutputSystem + System that generated the data (used to check if SISO/MIMO). + T : 1D array - Time values of the output + Time values of the output. Ignored if None. yout : ndarray Response of the system. This can either be a 1D array indexed by time @@ -478,9 +481,9 @@ def _process_time_response( xout : array, optional Individual response of each x variable (if return_x is True). For a - SISO system (or if a single input is specified), This should be a 2D + SISO system (or if a single input is specified), this should be a 2D array indexed by the state index and time (for single input systems) - or a 3D array indexed by state, input, and time. + or a 3D array indexed by state, input, and time. Ignored if None. transpose : bool, optional If True, transpose all input and output arrays (for backward @@ -545,7 +548,7 @@ def _process_time_response( raise ValueError("unknown squeeze value") # Figure out whether and how to squeeze the state data - if issiso and len(xout.shape) > 2: + if issiso and xout is not None and len(xout.shape) > 2: xout = xout[:, 0, :] # remove input # See if we need to transpose the data back into MATLAB form @@ -555,7 +558,8 @@ def _process_time_response( # For signals, put the last index (time) into the first slot yout = np.transpose(yout, np.roll(range(yout.ndim), 1)) - xout = np.transpose(xout, np.roll(range(xout.ndim), 1)) + if xout is not None: + xout = np.transpose(xout, np.roll(range(xout.ndim), 1)) # Return time, output, and (optionally) state return (tout, yout, xout) if return_x else (tout, yout)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: