In[15]:=
y[n_] ==
(
Sum[a[k] x[n-k],{k,0,Nmax}]
-Sum[b[k] y[n-k],{k,1,Mmax}]
);
Since this represents a linear shift-invariant system, we know that with input Exp[I 2Pi w n], the output must be of the form H[w] Exp[I 2Pi w n]. Exploiting this knowledge, we can determine H[w], the frequency response, by substituting these values for x[n] and y[n] respectively:
In[16]:=
H[w] Exp[I 2Pi w n] ==
(
Sum[a[k] Exp[I 2Pi w (n-k)],{k,0,Nmax}]
-Sum[b[k] H[w] Exp[I 2Pi w (n-k)],{k,1,Mmax}]
);
We can cancel the factor E[I 2Pi w n] that is common to both sides, and pull H[w] outside the sum, to yield:
In[17]:=
H[w] ==
(
Sum[a[k] Exp[I 2Pi w (-k)],{k,0,Nmax}]
- H[w] Sum[b[k] Exp[I 2Pi w (-k)],{k,1,Mmax}]
);
Now, it is easy to solve for H[w]. Let's let Mathematica do the work:
In[18]:=
Clear[a,b,H,Nmax,Mmax]; Solve[%,H[w]]
Out[18]=
-2 I k Pi w Sum[E a[k], {k, 0, Nmax}] {{H[w] -> ----------------------------------------}} -2 I k Pi w 1 + Sum[E b[k], {k, 1, Mmax}]
This is the transfer function of a general IIR filter. The transfer function of an FIR filter is the special case b[k]=0; that is, the denominator is unity.
Example: First-order IIR filter
Advanced topic: FIR filter as a truncated Fourier series approximation
Example: FIR approximation to an ideal LPF
Up to Discrete-time Filters