(y) = DiscreteStateSpace.timeResponse(dss, u) or (y, xc) = DiscreteStateSpace.timeResponse(dss, u, x0)
This function calculates the time responses to input u of a discrete state space system. Default of initial state x0 is x0=0.
import dss=Modelica_LinearSystems2.DiscreteStateSpace; import Modelica_LinearSystems2.StateSpace; StateSpace ss=Modelica_LinearSystems2.StateSpace( A=[-1], B=[1], C=[2], D=[0]); Real Ts=0.1; dss=dss(ss,Ts); Real x0[1]={0}; Real y[:,:]=dss.timeResponse(dss,ones(51,1)); // y=[0.09524, 0.2766, 0.4408,..., 1.9844, 1.9859, 1.9872]
encapsulated function timeResponse import Modelica; import Modelica_LinearSystems2; import Modelica_LinearSystems2.DiscreteStateSpace; input DiscreteStateSpace sd "Linear system in discrete state space form"; input Real u[:, size(sd.B, 2)] = ones(3, size(sd.B, 2)) "System input (dimension: (input samples) x (number of inputs))"; input Real x0[size(sd.A, 1)] = zeros(size(sd.A, 1)) "Initial system state"; output Real y[size(u, 1), size(sd.C, 1)] "System response (dimension: (input samples) x (number of outputs))"; output Real x_continuous[size(u, 1), size(sd.A, 1)] "State trajectories (dimension: (input samples) x (number of states)"; end timeResponse;
Date | Author | Comment |
---|---|---|
2010-05-31 | Marcus Baur, DLR-RM | Realization |