%% Impulse Response Length of Filter System object
% 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 the zp2sos function. 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)

% Copyright 2012 The MathWorks, Inc.