Computes the time response of the system StateSpace sc = StateSpace(A=[-1,1;0,-2],B=[1, 0;0, 1],C=[1,0; 0,1],D=[0, 0; 0, 0]), sampled at Ts=0.01 with inititial state x0=[0;0] subject to the system input u = ones(samples,2), (samples is set to 30).
function analysisTimeResponse extends Modelica.Icons.Function; import Modelica_LinearSystems2.StateSpace; import Modelica_LinearSystems2.Utilities.Types.TimeResponse; import Modelica_LinearSystems2.Utilities.Plot; input StateSpace sc = StateSpace(A = [-1, 1; 0, -2], B = [1, 0; 0, 1], C = [1, 0; 0, 1], D = [0, 0; 0, 0]); input TimeResponse response = TimeResponse.Step; input Real dt = 0.01; input Real span = 5; output Real y[samples, 2, 2] "System response (dimension: (input samples) x (number of outputs))"; output Real t[samples] "Time vector used for simulation"; output Real x[samples, 2, 2] "State trajectories (dimension: (input samples) x (number of states)"; end analysisTimeResponse;