# .Modelica_LinearSystems2.DiscreteZerosAndPoles.Analysis.timeResponse

## Information

#### Syntax

```(y, t, x)=DiscreteZerosAndPoles.Analysis.timeResponse(dzp, tSpan, responseType, x0)
```

#### Description

First, the DiscreteZerosAndPoles record is transformed into discrete state space representation which is given to DiscreteStateSpace.Analysis.timeResponse to calculate the time response of the state space system. The type of the time response is defined by the input responseType, i.e.

```Impulse "Impulse response",
Step "Step response",
Ramp "Ramp response",
Initial "Initial condition response"
```

Starting at x(t=0)=x0 and y(t=0)=C*x0 + D*u0, the outputs y and x are calculated for each time step t=k*dt.

#### Example

```  q=Modelica_LinearSystems2.DiscreteZerosAndPoles.q();
Modelica_LinearSystems2.DiscreteZerosAndPoles dzp=1/(q^2 + q + 1)
dzp.Ts=0.1;

Real tSpan= 0.4;
Modelica_LinearSystems2.Types.TimeResponse response=Modelica_LinearSystems2.Types.TimeResponse.Step;
Real x0[2]={0,0};

Real y[5,1,1];
Real t[5];
Real x[5,1,1]

algorithm
(y,t,x):=Modelica_LinearSystems2.DiscreteZerosAndPoles.Analysis.timeResponse(dzp,tSpan, response,x0);
//  y[:,1,1]={0, 0, 1, 0, 0}
//         t={0, 0.1, 0.2, 0.3, 0.4}
//  x[:,1,1]={0, 0, 3.0, 0, 0}
```

#### Interface

```encapsulated function timeResponse
import Modelica;
import Modelica_LinearSystems2;
import Modelica_LinearSystems2.DiscreteStateSpace;
import Modelica_LinearSystems2.DiscreteZerosAndPoles;
import Modelica_LinearSystems2.Utilities.Types.TimeResponse;