DSPRelated.com
Forums

IIR filter frequency response

Started by Dani September 9, 2004
Sorry if this seems a bit too lame, but I was wondering if someone might 
possibly tell me how to calculate the frequency response of an IIR filter 
having only it's coefficients.

Thanks
Dani wrote:

> Sorry if this seems a bit too lame, but I was wondering if someone might > possibly tell me how to calculate the frequency response of an IIR > filter having only it's coefficients. > > Thanks
By hand, or with software? You must realize that the coefficients are sufficient to locate the poles and zeros. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
In article <4140aedc$0$6907$61fed72c@news.rcn.com>,
Jerry Avins  <jya@ieee.org> wrote:
>Dani wrote: > >> Sorry if this seems a bit too lame, but I was wondering if someone might >> possibly tell me how to calculate the frequency response of an IIR >> filter having only it's coefficients. > >By hand, or with software? You must realize that the coefficients are >sufficient to locate the poles and zeros.
That may be true if you know the polynomial coefficients. Correct me if I'm wrong, but if only the filter coefficients are known, (that is, those things you multiply by the input values and prior output values and then sum together to get the next filter output), they aren't themselves sufficient for locating the poles and zeros. Dani wasn't specific about which coefficients were meant. That said, if one already knows the s-plane polynomial coefficients, the filter response is easily calculated by substituting jw for s (where j is sqrt(-1) and w is the frequency) and multiplying by its complex conjugate (-jw substituted for s). -Alex
Dani wrote:
>Sorry if this seems a bit too lame, but I was wondering if someone might >possibly tell me how to calculate the frequency response of an IIR >filter having only it's coefficients.
You don't need to find any poles and zeros. The transfer function can be found directly from the filter coefficients. Example: y(n) = a1*y(n-1) + b0*x(n) + b1*x(n-1) + b2*x(n-2) ... has the transfer function Y(Z) b0 + b1 Z^-1 + b2 Z^-2 H(Z) = ---- = ---------------------- X(Z) 1 - a1 Z^-1 To find the frequency response at theta=pi (folding frequency) Recall Z = exp( j*theta ) Z = exp(j*pi) = -1 b0 + b1*(-1) + b2*1 H(-1) = ---------------------- 1 - a1*(-1) Hope this helps, -- Mark
axlq wrote:

> In article <4140aedc$0$6907$61fed72c@news.rcn.com>, > Jerry Avins <jya@ieee.org> wrote: > >>Dani wrote: >> >> >>>Sorry if this seems a bit too lame, but I was wondering if someone might >>>possibly tell me how to calculate the frequency response of an IIR >>>filter having only it's coefficients. >> >>By hand, or with software? You must realize that the coefficients are >>sufficient to locate the poles and zeros. > > > That may be true if you know the polynomial coefficients. Correct > me if I'm wrong, but if only the filter coefficients are known, > (that is, those things you multiply by the input values and prior > output values and then sum together to get the next filter output), > they aren't themselves sufficient for locating the poles and zeros. > > Dani wasn't specific about which coefficients were meant. > > That said, if one already knows the s-plane polynomial coefficients, > the filter response is easily calculated by substituting jw for s > (where j is sqrt(-1) and w is the frequency) and multiplying by its > complex conjugate (-jw substituted for s). > > -Alex
You can calculate the filter coefficients from the polynomial coefficients -- that's the usual process of calculating on paper. I don't imagine that the calculation isn't reversible. Do you? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Dani wrote:

> Sorry if this seems a bit too lame, but I was wondering if someone might > possibly tell me how to calculate the frequency response of an IIR > filter having only it's coefficients. > > Thanks
Buried down toward the bottom of http://www.wescottdesign.com/articles/zTransform/z-transforms.html you will find detail on the method of getting a frequency response from an IIR filter if you have it's transfer function, and of getting it's transfer function if you have it's coefficients. It's basically what Mark Borgerding told you, but in more detail. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message
news:10k20bmcmbo9pf6@corp.supernews.com...
> Dani wrote: > > > Sorry if this seems a bit too lame, but I was wondering if someone might > > possibly tell me how to calculate the frequency response of an IIR > > filter having only it's coefficients. > > > > Thanks > > Buried down toward the bottom of > http://www.wescottdesign.com/articles/zTransform/z-transforms.html you > will find detail on the method of getting a frequency response from an > IIR filter if you have it's transfer function, and of getting it's > transfer function if you have it's coefficients. > > It's basically what Mark Borgerding told you, but in more detail. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
Tim, your site is getting better all the time. That takes a lot of effort. Axlq, you have got to get Mathcad. That is what I use. I am pretty sure that is what Tim uses to make his excellent web pages. At least get a decent math package. It will allow you to experiment and learn faster. I use least squares system identification to find the coefficients for the difference equation. From that I can calculate poles and zeros in the z and s domain. I get the feed forwards by inverting the model. Then I use pole placement to calculate the PID gains. Sometime I will have to investigate the Gain and Phase technique Tim uses. It is always good to have more arrows in your quiver. I like my technique because it is safe and works well with big saw/steel mill type systems while loaded and step inputs or sine waves aren't required. Peter Nachtwey
Dani <devil_slayer@nospam.com> wrote in message news:<opsd2p3i2fq81tw3@news.tpi.pl>...
> Sorry if this seems a bit too lame, but I was wondering if someone might > possibly tell me how to calculate the frequency response of an IIR filter > having only it's coefficients. > > Thanks
I learned the method just this week, from a thread here. :) If A=[a0,a1,...,aN]are the numerator coefficients and B=[b0,b1,...,bM] are the denominator coefficients in your transfer function, then H(w)=fft(A)./fft(B); in matlab lingo. This is just about the only instance where I would use spectral division. Rune
In article <tPudnXMKXKQlvdzcRVn-sg@comcast.com>,
Peter Nachtwey <peter@deltacompsys.com> wrote:
>Axlq, you have got to get Mathcad. That is what I use. I am pretty sure >that is what Tim uses to make his excellent web pages. At least get a >decent math package. It will allow you to experiment and learn faster.
I know, I know. I can't afford it. However, I did come up with a generalized solution for any arbitrary even-order all-pole filter, either lowpass or highpass. The generalized solution is at http://unicorn.us.com/alex/allpolefilters.html -- done by hand (the derivation as well as all the HTML), without help of MatchCad. I did find a free online Java thing called SymbMath which I used to solve for the roots of a quartic. SymbMath is also supposed to do algebraic manipulations but I couldn't get that to work. It looks like a powerful utility if I could get it to work.
>I use least squares system identification to find the coefficients for the >difference equation. From that I can calculate poles and zeros in the z >and s domain. I get the feed forwards by inverting the model. Then I use >pole placement to calculate the PID gains. Sometime I will have to >investigate the Gain and Phase technique Tim uses. It is always good to >have more arrows in your quiver. I like my technique because it is safe and >works well with big saw/steel mill type systems while loaded and step inputs >or sine waves aren't required.
Well, I'm pretty much satisfied now with what I have. All this started when I asked how to make a critically damped highpass filter. I now believe that a Bessel is best for my particular application, even though it's not quite critically damped. -Alex
In article <4140fa00$0$6928$61fed72c@news.rcn.com>,
Jerry Avins  <jya@ieee.org> wrote:
>You can calculate the filter coefficients from the polynomial >coefficients -- that's the usual process of calculating on paper. I >don't imagine that the calculation isn't reversible. Do you?
After thinking about it and reading other messages in this thread, I've changed my mind. It should be possible to reverse from the filter coefficients back to the original polynomial coefficients, or at least the roots of the polynomial. -Alex