You are here : matlabSignal Processingimpzlength

impzlength() - Signal Processing

len = impzlength(b,a) returns
the impulse response length for the causal discrete-time filter with
the rational system function specified by the numerator, b,
and denominator, a, polynomials in z–1.
For stable IIR filters, len is the effective
impulse response sequence length. Terms in the IIR filter's
impulse response after the len-th term are essentially
zero. examplelen = impzlength(sos) returns
the effective impulse response length for the IIR filter specified
by 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, impzlength considers the input to be
the numerator vector, b. Each row of sos corresponds
to the coefficients of a second order (biquad) filter. The ith
row of the sos matrix corresponds to [bi(1)
bi(2) bi(3) ai(1) ai(2) ai(3)].examplelen = impzlength(d) returns
the impulse response length for the digital filter, d.
Use designfilt to generate d based
on frequency-response specifications.examplelen = impzlength(hs) returns
the impulse response length for the filter System object™, hs.
You must have the DSP System Toolbox™ software to use impzlength with
a filter System object.examplelen = impzlength(hd) returns
the impulse response length for the dfilt filter
object, hd. You can also input an array of filter
objects. If hd is an array of filter objects, each
column of len is the impulse response length
of the corresponding filter object. len = impzlength(___,tol) specifies
a tolerance for estimating the effective length of an IIR filter's
impulse response. By default, tol is 5e-5.
Increasing the value of tol estimates a shorter
effective length for an IIR filter's impulse response. Decreasing
the value of tol produces a longer effective
length for an IIR filter's impulse response.


Syntax

len = impzlength(b,a) examplelen = impzlength(sos) examplelen = impzlength(d) examplelen = impzlength(hs) examplelen = impzlength(hd) examplelen = impzlength(___,tol)


Example

IIR Filter Effective Impulse Response Length -- CoefficientsOpen This ExampleCreate a lowpass allpole IIR filter with a pole at 0.9. Calculate the effective impulse response length. Obtain the impulse response. Plot the result.b = 1;
a = [1 -0.9];
len = impzlength(b,a)
[h,t] = impz(b,a);
stem(t,h)
h(len)

len =

    93


ans =

   6.1704e-05


IIR Filter Effective Impulse Response Length -- Second-Order SectionsOpen This ExampleDesign a 4th-order lowpass elliptic filter with a cutoff frequency of 
 rad/sample. Specify 1 dB of passband ripple and 60 dB of stopband attenuation. Design the filter in pole-zero-gain form and obtain the second-order section matrix using zp2sos. Determine the effective impulse response sequence length from the second-order section matrix.[z,p,k] = ellip(4,1,60,.4);
[sos,g] = zp2sos(z,p,k);
len = impzlength(sos)

len =

    80

IIR Filter Effective Impulse Response Length --- --- Digital FilterOpen This Example
Use designfilt to design a 4th-order lowpass elliptic filter with normalized passband frequency 
 rad/sample. Specify 1 dB of passband ripple and 60 dB of stopband attenuation. Determine the effective impulse response sequence length and visualize it.
d = designfilt('lowpassiir','FilterOrder',4,'PassbandFrequency',0.4, ...
               'PassbandRipple',1,'StopbandAttenuation',60, ...
               'DesignMethod','ellip');
len = impzlength(d)
impz(d)

len =

    80


Impulse Response Length of Filter System objectOpen This Example
This example requires DSP System Toolbox™ software.
Design a 4th-order lowpass elliptic filter with a cutoff frequency of 0.4*pi rad/sample. Specify 1 dB of passband ripple and 60 dB of stopband attenuation. Design the filter in pole-zero-gain form and obtain the second order section matrix using zp2sos. Create a biquad filter System object™ and input the System object to impzlength.[z,p,k] = ellip(4,1,60,.4);
[sos,g] = zp2sos(z,p,k);
hBqdFilt = dsp.BiquadFilter('Structure','Direct form I',...
                                            'SOSMatrix', sos,...
                                            'ScaleValues',g);
len = impzlength(hBqdFilt)

len =

    80

Impulse Response Length -- Filter ObjectsOpen This ExampleDesign IIR Butterworth and FIR equiripple filters for data sampled at 1 kHz. The passband frequency is 100 Hz and the stopband frequency is 150 Hz. The passband ripple is 0.5 dB and there is 60 dB of stopband attenuation. Obtain dfilt objects for the filters and compare the filter impulse response sequence lengths.d = fdesign.lowpass('Fp,Fst,Ap,Ast',100,150,0.5,60,1000);
Hd1 = design(d,'butter');
Hd2 = design(d,'equiripple');
len = impzlength([Hd1 Hd2])

len =

   183    49


Output / Return Value


Limitations


Alternatives / See Also


Reference