# 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.

# impulse

Impulse response for rational function object

### Note

`impulse` may be removed in a future release. Use `timeresp` instead.

## Syntax

```[resp,t] = impulse(h,ts,n) ```

## Description

`[resp,t] = impulse(h,ts,n)` computes the impulse response, `resp`, of the rational function object, `h`, over the time period specified by `ts` and `n`.

### Note

While you can compute the output response for a rational function object by computing the impulse response of the object and then convolving that response with the input signal, this approach is not recommended. Instead, you should use the `timeresp` method to perform this computation because it generally gives a more accurate output signal for a given input signal.

The input `h` is the handle of a rational function object. `ts` is a positive scalar value that specifies the sample time of the computed impulse response, and `n` is a positive integer that specifies the total number of samples in the response.

The vector of time samples of the impulse response, `t`, is computed from the inputs as `t = [0,ts,2*ts,...,(n-1)*ts]`. The impulse response, `resp`, is an `n`-element vector of impulse response values corresponding to these times. It is computed using the analytical form of the rational function

`$resp=\sum _{k=1}^{M}{C}_{k}{e}^{{A}_{k}\left(t-Delay\right)}u\left(t-Delay\right)+D\delta \left(t-Delay\right)$`

where

• `A`, `C`, `D`, and `Delay` are properties of the rational function object, `h`.

• `M` is the number of poles in the rational function object.

## Examples

collapse all

`Compute the impulse response of the data stored in the file passive.s2p by `

`fitting a rational function object to the data and using the impulse method`

`to compute the impulse response of the object.`

Section 1 Extract frequency and data from `passive.s2p`

`orig_data=read(rfdata.data,'passive.s2p')`
```orig_data = rfdata.data with properties: Freq: [202x1 double] S_Parameters: [2x2x202 double] GroupDelay: [202x1 double] NF: [202x1 double] OIP3: [202x1 double] Z0: 50.0000 + 0.0000i ZS: 50.0000 + 0.0000i ZL: 50.0000 + 0.0000i IntpType: 'Linear' Name: 'Data object' ```
```freq=orig_data.Freq; data=orig_data.S_Parameters(2,1,:);```

Section 2 Rational fit the data

`fit_data=rationalfit(freq,data)`
```fit_data = rfmodel.rational with properties: A: [6x1 double] C: [6x1 double] D: 0 Delay: 0 Name: 'Rational Function' ```

Section 3 Calculate the Impulse Response

```[resp,t]=impulse(fit_data,1e-12,1e4); plot(t,resp);```