(y) = DiscreteStateSpace.Analysis.initialResponse(x0, dss) (y, t, x) = DiscreteStateSpace.Analysis.initialResponse(x0, dss, tSpan)
Function initialResponse calculates the time response of a discrete state space system for given initial condition and zero inputs. Starting at x(t=0)=0 and y(t=0)=C*x0 + D*u0, the outputs y and x are calculated for each time step t=k*dss.Ts. The function call
DiscreteStateSpace.Analysis.initialResponse(x0,dss, dt, tSpan)
gives the same result as
DiscreteStateSpace.Analysis.timeResponse(dss, tSpan, response=Types.TimeResponse.Initial, x0=x0).
Modelica_LinearSystems2.DiscreteStateSpace dss=Modelica_LinearSystems2.DiscreteStateSpace( A=[0.904837418036 ], B=[0.095162581964], C=[2], D=[0], B2=[0], Ts=0.1, method = Modelica_LinearSystems2.Types.Method.StepExact); Real tSpan= 0.4; Real x0[1] = {1}; Real y[5,1,1]; Real t[5]; Real x[5,1,1] algorithm (y,t,x):=Modelica_LinearSystems2.DiscreteStateSpace.Analysis.initialResponse(x0,dss,tSpan); // y[:,1,1]={2, 1.809, 1.637, 1.4812, 1.3402} // t={0, 0.1, 0.2, 0.3, 0.4} // x[:,1,1]={1, 0.9048, 0.8186, 0.7406, 0.6701}
DiscreteStateSpace.Analysis.timeResponse, StateSpace.Analysis.initialResponse
encapsulated function initialResponse import Modelica; import Modelica_LinearSystems2; import Modelica_LinearSystems2.DiscreteStateSpace; input Real x0[:] = fill(0, 0) "Initial state vector"; extends Modelica_LinearSystems2.Internal.timeResponseMask_discrete(redeclare Real y[:, size(dss.C, 1), 1], redeclare Real x_discrete[:, size(dss.A, 1), 1]); end initialResponse;