# timeresp

Time response for rational object and `rationalfit` function object

## Syntax

``[outputsignal,t] = timeresp(h,inputsignal,ts)``

## Description

example

````[outputsignal,t] = timeresp(h,inputsignal,ts)` computes the output signal that the rational function object produces in response to a give input signal at the specified sample time, `ts`.```

## Examples

collapse all

Define the input signal.

```SampleTime = 2e-11; OverSamplingFactor = 25; TotalSampleNumber = 2^12; InputSignal = sign(randn(1, ... ceil(TotalSampleNumber/OverSamplingFactor))); InputSignal = repmat(InputSignal, [OverSamplingFactor, 1]); InputSignal = InputSignal(:);```

Create a rational function object.

```S = sparameters('default.s2p'); s21 = rfparam(S,2,1); datafreq = S.Frequencies; fit_data = rationalfit(datafreq,s21,'Tolerance',-32);```

Compute the time response.

`[y,t]=timeresp(fit_data,InputSignal,SampleTime);`

## Input Arguments

collapse all

Time varying input signal, specified as a real finite vector.

Data Types: `double`

Rational function object, specified as a `rationalfit` object.

Data Types: `double`
Complex Number Support: Yes

Sample time of the input signal, specified as a positive scalar integer in seconds.

Data Types: `double`

## Output Arguments

collapse all

Time varying output signal, returned as a real finite vector.

Data Types: `double`

Sample time of the output signal, returned as a nonnegative vector of time values with discrete step size `ts` corresponding to the data in `outputsignal` in seconds.

Data Types: `double`

collapse all

### Output Signal Equation

`timeresp` function uses the variant of the following equation to calculate the output signal:

`$Y\left(n\right)=sum\left(C.*X\left(n-Delay/ts\right)\right)+D*U\left(n-Delay/ts\right)$`

where,

`$\begin{array}{l}X\left(n+1\right)=F*X\left(n\right)+G*U\left(n\right)\\ X\left(1\right)=0\\ F=\mathrm{exp}\left(A*ts\right)\\ G=\left(F-1\right)./A\end{array}$`

`A`— complex vector of poles of the rational function

`C`—complex vector of residues of the rational function

`D`—scalar value specifying direct feedthrough, and

`Delay` — delay time are properties of the rational function object, `h`. For more information, see `rationalfit` function.

## Version History

Introduced in R2007a