0
$\begingroup$

How to subtract a digital filter from another one, if their lengths are different. How to make the length equal.

$\endgroup$
  • 2
    $\begingroup$ Add zeros to the shorter one? $\endgroup$ – Matt L. Aug 25 '17 at 9:55
1
$\begingroup$

If (and only if) the filters (either FIR or IIR) are linear, then you can subtract their coefficients term-wise, supposing they are correctly aligned (below, on the $0$ index), treating them as infinite series with trailing zeroes when the coefficients are not defined. For instance with:

$$h = [h_0, h_1, h_2]$$ and $$g = [g_{-1},g_0, g_1, g_2,g_3]$$

since the convolution with $h$ yields the same result as the convolution with a zero-padded $h$ (and $g$)

$$h' = [\ldots,0,0,h_0, h_1, h_2,0,0,\ldots]$$ the difference filter $d$ will have (symbolically $h'-g'$):

$$d = [\ldots,0,-g_{-1},h_0-g_{0}, h_1-g_{1}, h_2-g_{2},-g_{3},0,\ldots]$$

For FIR filters (or truncated IIR), you can limit to a finite sequence bounded by the smallest and the biggest index of both filters.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Does this work only for FIR or for IIR as well? $\endgroup$ – Ben Aug 25 '17 at 13:22
  • $\begingroup$ Indeed, hence the "as infinite series", if your IIR is written as an infinite sequence $\endgroup$ – Laurent Duval Aug 25 '17 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.