FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-09-2004, 09:07 PM
Dani
Guest
 
Posts: n/a
Default IIR filter frequency response

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
Reply With Quote
  #2 (permalink)  
Old 09-09-2004, 09:28 PM
Jerry Avins
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Reply With Quote
  #3 (permalink)  
Old 09-09-2004, 11:34 PM
axlq
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

In article <4140aedc$0$6907$[email protected]>,
Jerry Avins <[email protected]> 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
Reply With Quote
  #4 (permalink)  
Old 09-10-2004, 01:51 AM
Mark Borgerding
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

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
Reply With Quote
  #5 (permalink)  
Old 09-10-2004, 02:49 AM
Jerry Avins
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

axlq wrote:

> In article <4140aedc$0$6907$[email protected]>,
> Jerry Avins <[email protected]> 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.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Reply With Quote
  #6 (permalink)  
Old 09-10-2004, 03:20 AM
Tim Wescott
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

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/article...ransforms.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
Reply With Quote
  #7 (permalink)  
Old 09-10-2004, 05:34 AM
Peter Nachtwey
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

"Tim Wescott" <[email protected]> wrote in message
news:[email protected]..
> 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/article...ransforms.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



Reply With Quote
  #8 (permalink)  
Old 09-10-2004, 06:16 AM
Rune Allnor
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Dani <[email protected]> wrote in message news:<[email protected]>...
> 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
Reply With Quote
  #9 (permalink)  
Old 09-10-2004, 06:30 AM
axlq
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

In article <[email protected]>,
Peter Nachtwey <[email protected]> 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
Reply With Quote
  #10 (permalink)  
Old 09-10-2004, 06:31 AM
axlq
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

In article <4140fa00$0$6928$[email protected]>,
Jerry Avins <[email protected]> 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
Reply With Quote
  #11 (permalink)  
Old 09-10-2004, 07:26 AM
Tim Wescott
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Peter Nachtwey wrote:

snip
>
> Tim, your site is getting better all the time. That takes a lot of effort.


Thanks. I justify it by claiming that it's marketing.
>
> 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 desperately need to get a Mathcad upgrade because I'm on a new
machine, I've lost my old disks, and I can't install it on this machine!
The ads for Mathmatica, Maple and Mathcad all match; I haven't used
the other two so I can't vouch for them but they all address the same
market (and Mathcad uses, at least until recently, the Maple symbolic
engine).

I'm currently using Scilab (a _very good_ free Matlab replacement). It
won't do symbolics, but it makes pretty graphs, crunches huge matrices
with happy abandon, and has all sorts of nifty control and signal
processing stuff built in which are only available as extra toolboxes
under Matlab.

There are a few Mathcad-like applications for free, but I haven't been
impressed enough to download one; Mathcad is worth the $$$ if you can
swing it, but if you just can't you may want to google a bit.
>
> 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
>
>
>

So far I've been able to run sine-wave sweeps on my systems, so I
haven't been pushed to using least-squares identification. If you can't
use a step input, how do you stimulate the system to get sufficient
excitation for the system ID?

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply With Quote
  #12 (permalink)  
Old 09-10-2004, 09:02 AM
Martin Blume
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

"axlq" schrieb
> > 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.
>

GNU Octave at www.octave.org is free (GPL software) and an
excellent Matlab clone. It requires only your effort to
download and install it. The learning effort is minimal and can
also be applied to Matlab.

Regards
Martin




Reply With Quote
  #13 (permalink)  
Old 09-10-2004, 09:27 AM
Martin Blume
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

"Rune Allnor" schrieb
> > 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.
>


My method is based on physics (I have a mechanical engineering
background):

- take a hammer and pound at the system hard and short
(not too hard so as to break it, not too long so as to give
a nice Dirac impulse)
- then measure its frequency response

Translated into Matlab / Octave:

; the system
b = [0.25 0.25 0.25 0.25];
a = [ 1 ];
; the system at rest
x(1:1024)=0;
; the impulse
x(10)=1;
; the response
y=filter(b,a,x);
; visualization in the frequency domain
plot(abs(fft(y)));

The advantage is, in sw you can pound as hard and as long as
you like. In reality, the system behaves quite soon in a
non-linear fashion (= breaks).

HTH
Martin




Reply With Quote
  #14 (permalink)  
Old 09-10-2004, 04:12 PM
Tim Wescott
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Martin Blume wrote:

> "axlq" schrieb
>
>>>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.
>>

>
> GNU Octave at www.octave.org is free (GPL software) and an
> excellent Matlab clone. It requires only your effort to
> download and install it. The learning effort is minimal and can
> also be applied to Matlab.
>
> Regards
> Martin
>
>
>
>

Unless you want maximal compatibility with matlab scripts I would
recommend Scilab -- but Octave is very good (I have both Octave and
Scilab on my computer) and I haven't checked the benchmarks for very
large matrices.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply With Quote
  #15 (permalink)  
Old 09-10-2004, 05:29 PM
Jerry Avins
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Martin Blume wrote:

> "axlq" schrieb
>
>>>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.
>>

>
> GNU Octave at www.octave.org is free (GPL software) and an
> excellent Matlab clone. It requires only your effort to
> download and install it. The learning effort is minimal and can
> also be applied to Matlab.
>
> Regards
> Martin


Scilab is similar. I don't know what the differences are. I find it
useful, and installation was easy. http://scilabsoft.inria.fr/

Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Reply With Quote
  #16 (permalink)  
Old 09-10-2004, 05:34 PM
Jerry Avins
Guest
 
Posts: n/a
Default OT IIR filter frequency response

Martin Blume wrote:

...

> My method is based on physics (I have a mechanical engineering
> background):
>
> - take a hammer and pound at the system hard and short
> (not too hard so as to break it, not too long so as to give
> a nice Dirac impulse)
> - then measure its frequency response


This is a more sophisticated version of my general trouble-shooting
approach: poke it and watch how it wiggles.

...

Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

Reply With Quote
  #17 (permalink)  
Old 09-10-2004, 11:32 PM
Dani
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

I'd like to thank everybody for their marvelous replies.

Quite frankly I didn't expect so many answers and so quick so I didn't
check the replies until now. This must be one of the best newsgroups on
the net

I must read all these posts carefully before asking any further questions.

To make things clear though, I am making a system where I have the
"filter" coefficients and need the filter's magnitude response based on
these values.
To be honest, I'm trying to design a filterbank of BPFs and am too lazy to
implement any of the well known algorithms (too much calculations and too
little universality) so I decided to make a genetic algo that'd do this
for me.
To make a long story short: the filter coefficients are the genotypes and
the fitness function uses the filter's magnitude response to compare the
individuals with the ideal square filter's mag response.

So far I have used two methods:
-first I tried to caluclate the response using an equation I found on a
couple of places on the net and a book, it was loosley:
fft(b[])./(1-fft(a[]).
-then I tried to calculate an FIR filter magnitude response from the
impulse response of the IIR filter, but also had no luck.

Now I'll try what I found here and will keep you updated.

Thanks again yall!
Reply With Quote
  #18 (permalink)  
Old 09-11-2004, 02:07 AM
Tony
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

On Fri, 10 Sep 2004 07:12:20 -0700, Tim Wescott
<[email protected]> wrote:

>Martin Blume wrote:
>
>> "axlq" schrieb
>>
>>>>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.
>>>

>>
>> GNU Octave at www.octave.org is free (GPL software) and an
>> excellent Matlab clone. It requires only your effort to
>> download and install it. The learning effort is minimal and can
>> also be applied to Matlab.
>>
>> Regards
>> Martin
>>

>Unless you want maximal compatibility with matlab scripts I would
>recommend Scilab -- but Octave is very good (I have both Octave and
>Scilab on my computer) and I haven't checked the benchmarks for very
>large matrices.


So Octave is more compatible with Matlab scripts than SciLab? What
about other compatibilities? Ease of use? Results? Speed?

I too need to get up to speed with a free or low cost option (Matlab
is out of the question), so I'd really like to know the limitations of
SciLab, Octave and any other alternatives out there.

Tony (remove the "_" to reply by email)
Reply With Quote
  #19 (permalink)  
Old 09-11-2004, 03:08 AM
Tim Wescott
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Tony wrote:

snip

>
> So Octave is more compatible with Matlab scripts than SciLab? What
> about other compatibilities? Ease of use? Results? Speed?
>
> I too need to get up to speed with a free or low cost option (Matlab
> is out of the question), so I'd really like to know the limitations of
> SciLab, Octave and any other alternatives out there.
>
> Tony (remove the "_" to reply by email)


Scilab, Matlab and Octave are equally cryptic to use. Scilab, IMHO, has
the best help (but no printed matter to read). It also has a newsgroup
which isn't very responsive (at least to my questions).

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply With Quote
  #20 (permalink)  
Old 09-11-2004, 09:19 AM
Rune Allnor
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

"Martin Blume" <[email protected]> wrote in message news:<414158a3$0$701$[email protected]>...
> My method is based on physics (I have a mechanical engineering
> background):
>
> - take a hammer and pound at the system hard and short
> (not too hard so as to break it, not too long so as to give
> a nice Dirac impulse)
> - then measure its frequency response


OK, I just did that. The table where the PC stood, sounded for quite
some time afterwards. A crack opened in the top of the table, causing me
to emit some words not found even in the most liberal dictionaries.
Is that what's termed a 'break' statement? And what about the shrapnel
from the electronics? It has to go back into the PC, right? Is that
what's called 'feedback'?

Rune

< sorry, I just couldn't resist... >
Reply With Quote
  #21 (permalink)  
Old 09-13-2004, 09:25 AM
Bernhard Holzmayer
Guest
 
Posts: n/a
Default Re: IIR filter frequency response

Tony wrote:

....
> So Octave is more compatible with Matlab scripts than SciLab? What
> about other compatibilities? Ease of use? Results? Speed?
>
> I too need to get up to speed with a free or low cost option
> (Matlab is out of the question), so I'd really like to know the
> limitations of SciLab, Octave and any other alternatives out
> there.
>
> Tony (remove the "_" to reply by email)


I didn' try Octave.

I like Matlab, because it provides a lot of toolboxes and blocksets,
which helps when first approaching new stuff.
Simulink provides even automatic generation of VHDL code,
and it really works!

When it comes to precision of calculation, I found SciLab to be
superior.

Scripts are very similar - I indeed created scripts which run in
both worlds (with some if matlab then ... else ... constructs).

If your budget is low, use Scilab instead of Matlab.
If you need special features, buy Matlab/Simulink, but benefit of
your Scilab in parallel!

Bernhard





Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frequency response of a PLL. What does it convey Ted DSP 2 07-28-2004 07:19 AM
Filter with (x/sin(x))^N frequency response? David Joseph Bonnici DSP 9 06-04-2004 08:08 AM
FIR roots and frequency response Bob Cain DSP 73 02-26-2004 08:02 PM
Frequency response of an FIR filter I. R. Khan DSP 4 02-18-2004 03:31 AM
Frequency response of DFT single bin Jon Harris DSP 6 09-11-2003 01:46 AM


All times are GMT +1. The time now is 02:26 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved