impzlength
Length of impulse response of discrete-time filter System object
Syntax
Description
analyzes the filter System object based on the arithmetic specified in len
= impzlength(___,Arithmetic=arithType
)arithType
, using
either of the previous syntaxes.
For more input options, see impzlength
in Signal Processing Toolbox™.
Examples
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 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 an SOS filter object and input the object to impzlength
.
[z,p,k] = ellip(4,1,60,.4); [sos,g] = zp2sos(z,p,k); [num,den] = sos2ctf(sos); hSosFilt = dsp.SOSFilter(Structure='Direct form I',... Numerator=num,Denominator=den,... ScaleValues=g); len = impzlength(hSosFilt)
len = 80
Impulse Response Length for Filter System Objects
Design an IIR Butterworth and an FIR equiripple filter for data sampled at 1 kHz. Set the passband frequency to 100 Hz and the stopband frequency to 150 Hz. Set the passband ripple to 0.5 dB and the stopband attenuation to 60 dB. Create System 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',SystemObject=true)
Hd1 = dsp.SOSFilter with properties: Structure: 'Direct form II' CoefficientSource: 'Property' Numerator: [9x3 double] Denominator: [9x3 double] HasScaleValues: true ScaleValues: [0.1020 0.0927 0.0852 0.0793 0.0748 0.0713 0.0689 0.0673 0.0665 1] Use get to show all properties
Hd2 = design(d,'equiripple',SystemObject=true)
Hd2 = dsp.FIRFilter with properties: Structure: 'Direct form' NumeratorSource: 'Property' Numerator: [-7.9808e-04 -2.8559e-04 0.0011 0.0036 0.0064 0.0079 0.0063 0.0012 -0.0059 -0.0115 -0.0116 -0.0044 0.0081 0.0197 0.0229 0.0126 -0.0098 -0.0346 -0.0473 -0.0340 0.0109 0.0808 0.1572 0.2164 0.2387 0.2164 0.1572 ... ] (1x49 double) InitialConditions: 0 Use get to show all properties
len = [impzlength(Hd1) impzlength(Hd2)]
len = 1×2
183 49
Input Arguments
sysobj
— Filter System object
filter System object
tol
— Tolerance for IIR filter effective impulse response length
5e-5
(default) | positive scalar
Tolerance for IIR filter effective impulse response length, specified as a positive number. The tolerance determines the term in the absolutely summable sequence after which subsequent terms are considered to be 0. Increasing the tolerance returns a shorter effective impulse response sequence length. Decreasing the tolerance returns a longer effective impulse response sequence length.
arithType
— Arithmetic type
'double'
(default) | 'single'
| 'Fixed'
Arithmetic used in the filter analysis, specified as 'double'
,
'single'
, or 'Fixed'
. When the arithmetic
input is not specified and the filter System object is unlocked, the analysis tool assumes a double-precision filter. When the
arithmetic input is not specified and the System object is locked, the function performs the analysis based on the data type of
the locked input.
The 'Fixed'
value applies to filter System objects with fixed-point
properties only.
When the 'Arithmetic'
input argument is specified as
'Fixed'
and the filter object has the data type of the
coefficients set to 'Same word length as input'
, the arithmetic
analysis depends on whether the System object is unlocked or locked.
unlocked –– The analysis object function cannot determine the coefficients data type. The function assumes that the coefficients data type is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.
locked –– When the input data type is
'double'
or'single'
, the analysis object function cannot determine the coefficients data type. The function assumes that the data type of the coefficients is signed, has a 16-bit word length, and is auto scaled. The function performs fixed-point analysis based on this assumption.
To check if the System object is locked or unlocked, use the isLocked
function.
When the arithmetic input is specified as 'Fixed'
and the filter
object has the data type of the coefficients set to a custom numeric type, the object
function performs fixed-point analysis based on the custom numeric data type.
Output Arguments
len
— Length of impulse response
positive integer
Length of the impulse response, specified as a positive integer. For stable IIR
filters with absolutely summable impulse responses, impzlength
returns an effective length for the impulse response beyond which the coefficients are
essentially zero. You can control this cutoff point by specifying the optional
tol
input argument.
Version History
Introduced in R2013aR2024b: Support for dsp.VariableFIRDecimator
and dsp.VariableFIRInterpolator
Objects
Starting in R2024b, the impzlength
analysis function supports the
dsp.VariableFIRDecimator
and dsp.VariableFIRInterpolator
objects.
R2024b: dsp.BiquadFilter
object warns
The dsp.BiquadFilter
object issues a warning and will be removed in a
future release. Use the dsp.SOSFilter
object
instead. For more information on how to replace your existing code, see the
Compatibility Considerations section in the dsp.BiquadFilter
reference page.
R2024b: Support for dsp.DCBlocker
object
Starting in R2024b, this function supports the dsp.DCBlocker
object.
R2023b: Support for dsp.ParallelFilter
and dsp.Delay
Objects
Starting in R2023b, the impzlength
analysis function supports the
dsp.ParallelFilter
and the dsp.Delay
objects.
R2023b: dsp.BiquadFilter
object will be removed
The dsp.BiquadFilter
object will be removed in a future release. Use
the dsp.SOSFilter
object
instead.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)