DSPRelated.com
Forums

IIR Coefficient Calculation

Started by ger_lough April 17, 2014
On 4/22/14 10:09 PM, clay@claysturner.com wrote:
> You may transform the filter type (e.g. low pass to high pass by letting s = 1/s) in the Laplace domain and then apply the bilinear transform. > > Example low pass -> H(s) = 1/(1+s) > > transform by replacing s with 1/s H(1/s) = 1/(1+1/s) > > = s/(1+s) > (high pass with cutoff at 1 rad/sec.)
now that i think of it, i have to agree with Clay. so the best thing to do is obtain "normalized s" prototypes for all of your analog filters *first* (LPF, HPF, BPF, notch, Butterworth, Tchebyshev, etc.), then transform with the same transformation Clay (and the cookbook) mention. remember when transforming a LPF prototype to a *resonant* filter (such as BPF and notch), that will *double* the order (in s) of the filter. so usually, for a biquad, a 1st-order LPF is the original prototype and the result is a 2nd-order prototype in normalized s. LPF to HPF: s <-- 1/s LPF to BPF: s <-- Q*(s + 1/s) LPF to notch: s <-- Q/(s + 1/s) the result are all normalized s. then (from the cookbook): 1 1 - z^-1 (normalized) s <-- ----------- * ---------- tan(w0/2) 1 + z^-1 where w0 is your resonant frequency in "radians per sample". if you don't like the tan() function, the trig identities mentioned in the cookbook might be useful. i found them useful (even *if* i got a cos(w0) that i later have to deal with its numerical problems). sin(w0) 1 - cos(w0) tan(w0/2) = ------------- (tan(w0/2))^2 = ------------- 1 + cos(w0) 1 + cos(w0) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On 4/23/14 1:02 PM, robert bristow-johnson wrote:
> On 4/22/14 10:09 PM, clay@claysturner.com wrote: >> You may transform the filter type (e.g. low pass to high pass by >> letting s = 1/s) in the Laplace domain and then apply the bilinear >> transform. >> >> Example low pass -> H(s) = 1/(1+s) >> >> transform by replacing s with 1/s H(1/s) = 1/(1+1/s) >> >> = s/(1+s) >> (high pass with cutoff at 1 rad/sec.) > > now that i think of it, i have to agree with Clay. so the best thing to > do is obtain "normalized s" prototypes for all of your analog filters > *first* (LPF, HPF, BPF, notch, Butterworth, Tchebyshev, etc.), then > transform with the same transformation Clay (and the cookbook) mention. > > remember when transforming a LPF prototype to a *resonant* filter (such > as BPF and notch), that will *double* the order (in s) of the filter. so > usually, for a biquad, a 1st-order LPF is the original prototype and the > result is a 2nd-order prototype in normalized s. > > > LPF to HPF: s <-- 1/s > > LPF to BPF: s <-- Q*(s + 1/s)
made a mistake here (regarding Q):
> LPF to notch: s <-- Q/(s + 1/s)
should be: LPF to notch: s <-- 1/( Q*(s + 1/s) )
> the result are all in normalized s.
-- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Just an update if anyone else is in the same boat as me and not quite a DSP
guru..  I got my hands on a copy of "Discrete-Time Digital Signal
Processing" by Oppenheim, Schafer and Buck. It deals with digital IIR
design (and coefficient calculation) very well, not so difficult to follow.
It's the best piece of literature I've come across yet for higher order (N
> 2) digital IIR design.
Thanks again for all of the pointers, starting to make sense now. Ger _____________________________ Posted through www.DSPRelated.com
if you can spring for a copy of this

http://www.mds.com/products/qed-version-comparison

it can be very helpful for non dsp gurus like me.

Mark

>if you can spring for a copy of this > >http://www.mds.com/products/qed-version-comparison > >it can be very helpful for non dsp gurus like me. > >Mark > >
Thanks Mark. This seems to be doing the job (behind the scenes) of what I am trying to do which is IIR filter design/coefficient calculation. I'll have to stick with the old pencil and paper, polynomial factorisation, BLT, etc for now. Cheers Ger _____________________________ Posted through www.DSPRelated.com
Hi all, 
I've made progress, but have hit an obstacle. I am happy enough with
coefficient calculation once poles and zeros have been found. In the
examples I have looked at, the starting point is a set of initial
conditions using inequalities. 
For example, a low pass filter is specified as:

0.9 <= |H(e^j*&omega;)| <=1,      0<= |&omega;| <= 0.2&pi;

|H(e^j*&omega;)| <= 0.17783,     0.3&pi; <= |&omega;| <= &pi;

The magnitude squared function of a Butterworth filter is (c should be a
sub-character):

|Hc(j&Omega;)|^2 = 1 / (1 + (&Omega;/&Omega;c)^2N)

Using the above equations, we solve for N and &Omega;c and from this, we have
the can find the poles. 

What I would like to do is design a Butterworth filter from specification
of cut-off frequency and dB/octave gain reduction. 

So my question is this: Is there a method to calculate the magnitude
response inequalities as above from a specification of centre frequency and
dB /octave gain reduction?
If I just want a filter low-pass Butterworth specified by centre frequency
and dB gain reduction, how would I go about finding the poles?

	 

_____________________________		
Posted through www.DSPRelated.com
Hi all, 
I've made progress, but have hit an obstacle. I am happy enough with
coefficient calculation once poles and zeros have been found. In the
examples I have looked at, the starting point is a set of initial
conditions using inequalities. 
For example, a low pass filter is specified as:

0.9 <= |H(e^j*&omega;)| <=1,      0<= |&omega;| <= 0.2&pi;

|H(e^j*&omega;)| <= 0.17783,     0.3&pi; <= |&omega;| <= &pi;

The magnitude squared function of a Butterworth filter is (c should be a
sub-character):

|Hc(j&Omega;)|^2 = 1 / (1 + (&Omega;/&Omega;c)^2N)

Using the above equations, we solve for N and &Omega;c and from this, we have
the can find the poles. 

What I would like to do is design a Butterworth filter from specification
of cut-off frequency and dB/octave gain reduction. 

So my question is this: Is there a method to calculate the magnitude
response inequalities as above from a specification of centre frequency and
dB /octave gain reduction?
If I just want a filter low-pass Butterworth specified by centre frequency
and dB gain reduction, how would I go about finding the poles?

	 

_____________________________		
Posted through www.DSPRelated.com
Characters didn't come out right above. &Omega; is upper-case omega and &omega; is
lower case omega.	 

_____________________________		
Posted through www.DSPRelated.com
Apologies for the gobbledygook above, greek characters obviously not
supported here. 

In case anyone did try to follow it and had the same issue, my problem was
solved after I discovered that the cut-off slope is related to the filter
order by:

cut-off = 6N dB/octave

where N = IIR filter order.  	 

_____________________________		
Posted through www.DSPRelated.com
On 8/13/14 5:07 PM, ger_lough wrote:
> Apologies for the gobbledygook above, greek characters obviously not > supported here. > > In case anyone did try to follow it and had the same issue, my problem was > solved after I discovered that the cut-off slope is related to the filter > order by: > > cut-off = 6N dB/octave > > where N = IIR filter order. >
more precisely 6.0206 N dB/oct . :-) this is the slope at the outer asymptotes assuming . the slope around the cutoff varies not just with N, but also a function of the kind of filter. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."