Accelerating the pace of engineering and science

• 평가판
• 제품 업데이트

# impz

Impulse response of digital filter

## Syntax

[h,t] = impz(b,a)
[h,t] = impz(sos)
[h,t] = impz(Hd)
[h,t] = impz(...,n)
[h,t] = impz(...,n,fs)
impz(...)

## Description

[h,t] = impz(b,a) returns the impulse response of the filter with numerator coefficients b and denominator coefficients a. impz chooses the number of samples and returns the response in the column vector h and sample times in the column vector t (where t = [0:n-1]', and n = length(t) is computed automatically).

 Note:   If the input to impz is single precision, the impulse response is calculated using single-precision arithmetic. The output, h, is single precision.

[h,t] = impz(sos) returns the impulse response for the second order sections matrix, sos. sos is a K-by-6 matrix, where the number of sections, K, must be greater than or equal to 2. If the number of sections is less than 2, impz considers the input to be the numerator vector, b. Each row of sos corresponds to the coefficients of a second order (biquad) filter. The i-th row of the sos matrix corresponds to [bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].

[h,t] = impz(Hd) returns the impulse response for the dfilt filter object, Hd, or the array of dfilt filter objects. If Hd is an array of dfilt objects, each column of h is the impulse response of the corresponding dfilt object.

[h,t] = impz(...,n) computes n samples of the impulse response when n is an integer (t = [0:n-1]'). If n is a vector of integers, impz computes the impulse response at those integer locations, starting the response computation from 0 (and t = n or t = [0 n]). If, instead of n, you include the empty vector [] for the second argument, the number of samples is computed automatically by default.

[h,t] = impz(...,n,fs) computes n samples and produces a vector t of length n so that the samples are spaced 1/fs units apart.

impz(...) with no output arguments plots the impulse response of the filter. If you input the filter coefficients or second order sections matrix, the current figure window is used. If you input a dfilt object or array of filter objects, fvtool is used to plot the impulse response.

 Note   impz works for both real and complex input systems.

## Examples

Plot the first 50 samples of the impulse response of a fourth-order lowpass elliptic filter with cutoff frequency of 0.4 times the Nyquist frequency:

```[b,a] = ellip(4,0.5,20,0.4);
impz(b,a,50)
```

The same example using a dfilt object and displaying the result in the Filter Visualization Tool (fvtool) is

```[b,a] = ellip(4,0.5,20,0.4);
Hd = dfilt.df1(b,a)
impz(Hd,50)
```

expand all

### Algorithms

impz filters a length n impulse sequence using

```filter(b,a,[1 zeros(1,n-1)])
```

and plots the results using stem.

To compute n in the auto-length case, impz either uses n = length(b) for the FIR case or first finds the poles using p = roots(a), if length(a) is greater than 1.

If the filter is unstable, n is chosen to be the point at which the term from the largest pole reaches 10^6 times its original value.

If the filter is stable, n is chosen to be the point at which the term due to the largest amplitude pole is 5*10^-5 of its original amplitude.

If the filter is oscillatory (poles on the unit circle only), impz computes five periods of the slowest oscillation.

If the filter has both oscillatory and damped terms, n is chosen to equal five periods of the slowest oscillation or the point at which the term due to the largest (nonunity) amplitude pole is 5*10^-5 of its original amplitude, whichever is greater.

impz also allows for delays in the numerator polynomial. The number of delays is incorporated into the computation for the number of samples.