Signal Toolkit - impzlength


Function File: len = impzlength (b)
Function File: len = impzlength (b, a)
Function File: len = impzlength (sos)
Function File: len = impzlength (…, tol)

Return the impulse response length of the specified filter.

For a finite impulse response (FIR) filter specified by the numerator coefficients b, the length is simply the number of coefficients in b.

For an infinite impulse response (IIR) filter specified by the numerator b and denominator a polynomials in z^-1, the function computes an effective impulse response sequence length.

The filter can also be specified by a K-by-6 second-order sections matrix sos, where K is the number of sections. In this case, the matrix is converted to transfer function form b and a before computing the length.

The algorithm proceeds as follows:

  1. If the filter is FIR, the length is simply length (b).
  2. The poles of the transfer function are computed as the roots of the denominator polynomial a.
  3. The multiplicity of the dominant pole (the pole with the largest magnitude) is determined by counting poles at the same complex coordinate within tolerance.
  4. For a stable IIR filter (dominant pole magnitude < 1 - 10^{-5}), the effective length is estimated as

    floor (M * log10 (tol) / log10 (maxpole)) + delay

    where M is the multiplicity of the dominant pole and d is the initial delay (number of leading zeros in b).

  5. For an unstable IIR filter (dominant pole magnitude > 1 + 10^{-4}), a heuristic formula is used:

    floor (6 / log10 (maxpole))

  6. For filters with poles near the unit circle (oscillatory behavior), the length is the maximum of: five periods of the slowest oscillation, and the decay length of damped poles, plus the initial delay.

The optional argument tol specifies the tolerance used to estimate the effective length of an IIR filter’s impulse response. The default tolerance is 5e-5. Increasing tol estimates a shorter effective length, while decreasing tol produces a longer effective length.

The returned value len is the effective impulse response length of the specified filter. This function is used by impz and stepz to determine the number of points to plot.

See also: impz, stepz.