# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# timeresp

Time response for rational function object

## Syntax

```[y,t] = timeresp(h,u,ts) ```

## Description

`[y,t] = timeresp(h,u,ts)` computes the output signal, `y`, that the rational function object, `h`, produces in response to the given input signal, `u`.

The input `h` is the handle of a rational function object returned by `rationalfit`. `ts` is a positive scalar value that specifies the sample time of the input signal.

The output `y` is the output signal. RF Toolbox™ software computes the value of the signal at the time samples in the vector `t` using the following equation.

`$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}$`
and `A`, `C`, `D`, and `Delay` are properties of the rational function object, `h`.

## Examples

The following example shows you how to compute the time response of the data stored in the file `default.s2p` by fitting a rational function object to the data and using the `timeresp` method to compute the time response of the object.

```% Define the input signal SampleTime = 2e-11; OverSamplingFactor = 25; TotalSampleNumber = 2^12; InputTime = double((1:TotalSampleNumber)')*SampleTime; InputSignal = sign(randn(1, ... ceil(TotalSampleNumber/OverSamplingFactor))); InputSignal = repmat(InputSignal, [OverSamplingFactor, 1]); InputSignal = InputSignal(:); % Create a rational function object orig_data=read(rfdata.data,'default.s2p'); freq=orig_data.Freq; data=orig_data.S_Parameters(2,1,:); fit_data=rationalfit(freq,data); % Compute the time response [y,t]=timeresp(fit_data,InputSignal,SampleTime); ```