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 07-07-2007, 09:00 PM
sancho-fx1
Guest
 
Posts: n/a
Default Discrete IIR and step size

Hi,
I have implemented a simple IIR filtering algorithm (the one described i
the dspguide book). The filter works inside a simulation application an
the step size of the simulation can be changed by the user. However i
stays constant throughout a simulation run. So my question is, how can
achieve identical results (as far as possible) of the IIR filtering wit
different step sizes.
Currently the output of the filter for identical parameters will b
different if the step size has changed.

So my question would be. Is it possible to somehow 'compensate' fo
changes in the step size and if so, how would one implement it in the II
calculation?

Greetings,
Marcus


Reply With Quote
  #2 (permalink)  
Old 07-08-2007, 06:28 AM
robert bristow-johnson
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

On Jul 7, 4:00 pm, "sancho-fx1" <sancho-...@gmx.de> wrote:
> Hi,
> I have implemented a simple IIR filtering algorithm (the one described in
> the dspguide book). The filter works inside a simulation application and
> the step size of the simulation can be changed by the user.


do you mean, by "step size", the reciprocal of the sampling frequency?

> However it
> stays constant throughout a simulation run. So my question is, how can I
> achieve identical results (as far as possible) of the IIR filtering with
> different step sizes.


assuming what i speculated above *and* that the IIR filter order is
fixed, if all of the interesting stuff about the IIR's frequency
response is much less than the reciprocal of the step size, you can
make the different simulations give you comparable results - i.e. the
impulse response of the IIR is a virtually identical function, but
simply sampled at different rates.

but, because of frequency-domain aliasing of the frequency response
(that you get from sampling the impulse response) from Impulse
Invariant and because of frequency warping of the frequency response
from the Bilinear Transform, i don't think you'll be able to acheive
identical results for an IIR filter that has salient frequency-domain
features in the entire spectrum from virtually DC to virtually
Nyquist. something on one end or the other will get ****ed up by any
discrete-time simulation other than the simulation that is synonymous
with the original IIR that you are comparing other sampling rate
implementations with.

> Currently the output of the filter for identical parameters will be
> different if the step size has changed.
>
> So my question would be. Is it possible to somehow 'compensate' for
> changes in the step size and if so, how would one implement it in the IIR
> calculation?


you could map the IIR coefficients according the the Impulse Invariant
method or the Bilinear Transform method. the two methods do it
differently and do not share the same degree of naturalness regarding
representation of the filter's transfer function (or the
implementation of the filter structure) as a series (cascade) 2nd-
order sections or as parallel sections. the BLT is fits series
biquads and II favors parallel.

it's a mess. for II you represent each complex pole pair as it's
impulse response:

h[n] = u[n]*A*exp(-alpha*n)*cos(omega*n + phi) + B*delta[n]


which has transfer function:

H(z) = (b0 + b1*z^-1 + b2*z^-2)/(1 + a1*z^-1 + a2*z^-2)

where

a1 = -2*exp(-alpha)*cos(omega)
a2 = exp(-2*alpha)
b0 = A*cos(phi) + B
b1 = -A*exp(-alpha)*cos(omega-phi) - B*2*exp(-alpha)*cos(omega)
b2 = + B*exp(-2*alpha)

so somehow you gotta map the five coefficients a1, a2, b0, b1, and b2,
to the five parameters alpha, omega, phi, A, and B (this is a bitch
and i am too lazy to do that). leave A, B, and phi unchanged but
scale alpha and omega in inverse proportion to how your step size got
scaled. then use the formulas above to get you new coefs a1..b2, for
the simulation with your changed step size. the impulse response (of
each section and therefore the sum of all of these parallel sections)
will be the same continuous-time impulse response but sampled at
different step sizes.

the Bilinear Transform will similarly painful but you will represent
your IIR filter as cascaded biquad sections and remap the same
continuous-time biquad to a discrete-time biquad filter with different
sampling rates (or step sizes).

famous last words: "all this is conceptully straight-forward and
doable but the details are left to the reader."

r b-j

Reply With Quote
  #3 (permalink)  
Old 07-08-2007, 12:13 PM
sancho-fx1
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

Thanks a lot for your response. I will try to wade through your suggestion
but they sound quite complicated to me.
In this respect I've got another question which is related to my first
Let's assume I have finally found a set of coefficients for my IIR whic
'solve' a given problem. If I understood correctly, these coefficien
values will only be 'correct' for a single sampling rate of the signal. S
if someone want to use the filter with a signal of a different samplin
rate, he need to somehow solve the tasks you described before, right?

Now my question would be, if I want to describe the filter properties, fo
example in a publication, how would I do it in a way that is independent o
the sampling rate I used?
Would it be preferable to publish impulse response plots instead of th
filter coefficients?

Thanks again for your support.

Greetings,
Marcus
Reply With Quote
  #4 (permalink)  
Old 07-08-2007, 02:53 PM
Rune Allnor
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

On 8 Jul, 13:13, "sancho-fx1" <sancho-...@gmx.de> wrote:
> Thanks a lot for your response. I will try to wade through your suggestions
> but they sound quite complicated to me.


That's because they are. RBJ is perfectly right in that the
general idea is simple, but that actually doing it is a bit
involved.

> In this respect I've got another question which is related to my first.
> Let's assume I have finally found a set of coefficients for my IIR which
> 'solve' a given problem. If I understood correctly, these coefficient
> values will only be 'correct' for a single sampling rate of the signal.


Correct.

> So
> if someone want to use the filter with a signal of a different sampling
> rate, he need to somehow solve the tasks you described before, right?


Correct.

The thing is that a digital filter is designed in terms of *relative*
frequency
in digital domain. If you want a cut-off at 10 Hz and the sampling
rate is
50 Hz, the relative cut-off frequency is 10/50 = 0.2. If the sampling
frequency is 100 Hz, the cut off at 10 Hz becomes a relative
frequency
of 10/100 = 0.1.

> Now my question would be, if I want to describe the filter properties, for
> example in a publication, how would I do it in a way that is independent of
> the sampling rate I used?


You can't, if you use a discrete-time filter to process a sampled
process. You have to state the sampling rate to convince the readers
of your article that you did a good job. Lots of people become
very sceptical if a system is sampled too close to the Nyquist limit.

> Would it be preferable to publish impulse response plots instead of the
> filter coefficients?


Depends on what you want to express. Lots of people prefer to use
spectrum magnitude plots when describing filters.

Rune

Reply With Quote
  #5 (permalink)  
Old 07-08-2007, 07:39 PM
Tim Wescott
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

On Sun, 08 Jul 2007 06:53:43 -0700, Rune Allnor wrote:

> On 8 Jul, 13:13, "sancho-fx1" <sancho-...@gmx.de> wrote:
>> Thanks a lot for your response. I will try to wade through your suggestions
>> but they sound quite complicated to me.

>
> That's because they are. RBJ is perfectly right in that the
> general idea is simple, but that actually doing it is a bit
> involved.
>
>> In this respect I've got another question which is related to my first.
>> Let's assume I have finally found a set of coefficients for my IIR which
>> 'solve' a given problem. If I understood correctly, these coefficient
>> values will only be 'correct' for a single sampling rate of the signal.

>
> Correct.
>
>> So
>> if someone want to use the filter with a signal of a different sampling
>> rate, he need to somehow solve the tasks you described before, right?

>
> Correct.
>
> The thing is that a digital filter is designed in terms of *relative*
> frequency
> in digital domain. If you want a cut-off at 10 Hz and the sampling
> rate is
> 50 Hz, the relative cut-off frequency is 10/50 = 0.2. If the sampling
> frequency is 100 Hz, the cut off at 10 Hz becomes a relative
> frequency
> of 10/100 = 0.1.
>
>> Now my question would be, if I want to describe the filter properties, for
>> example in a publication, how would I do it in a way that is independent of
>> the sampling rate I used?

>
> You can't, if you use a discrete-time filter to process a sampled
> process. You have to state the sampling rate to convince the readers
> of your article that you did a good job. Lots of people become
> very sceptical if a system is sampled too close to the Nyquist limit.


Or outright disbelieving. Particularly if they check your numbers and
find them flawed.
>
>> Would it be preferable to publish impulse response plots instead of the
>> filter coefficients?

>
> Depends on what you want to express. Lots of people prefer to use
> spectrum magnitude plots when describing filters.
>
> Rune


If your sampling rate gets to be a large fraction of your filter bandwidth
then the impulse response cannot be reasonably matched vs. a system with a
higher sampling rate, at least not unless you're suddenly doing
interesting things in the analog world.

One of the constraints of sampled-time design is that you have to choose
your sampling rate wisely, which means you also have to justify it.

You _may_ be able to design your system with some specified minimum
sampling rate, with an embedded filter design algorithm that redesigns
everything when the sampling rate changes. This wouldn't be a bad idea,
but it's up to you to make it work and to justify it. It's also up to you
to figure out how your reconstruction filters are going to work when you
change the sampling rate of the signal going into them.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply With Quote
  #6 (permalink)  
Old 07-09-2007, 06:36 PM
sancho-fx1
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

Maybe for the records or for discussion also:

In case of a single pole filter I found out that one can fairly eas
compensate for a different frequency by re-calculating the b1 coefficient
in the recursion equation:
y[n] = a0*x[n] + a1*[n-1] + b1 * [n-1]

So if f1 is the 'old' sampling frequency and f2 is the frequency one like
to 'approximate' it should be possible to find a new b1 coefficient for th
new frequency via:
b1_new = 1-(1-b1)/(f1/f2)

I don't know if this is mathematically correct (maybe someone likes t
calculate this?), but as b1 defines the attenuation from one sample to th
next, changing b1 should be sufficient to compensate for a differen
sampling frequency in this simple case. (Probably this will have it'
limitations...)

What do you mean ?


Greetings,
Marcus
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
[Question] Quantization step size for DCT coefficients jamescolin_comp@yahoo.com DSP 0 12-07-2006 06:52 AM
Variable step size LMS Richard_K DSP 2 11-16-2006 10:43 PM
Very small time step in Discrete Kalman filter OKH DSP 1 06-27-2006 06:55 PM
how to find the best ADC step size? lucy DSP 28 01-02-2005 01:56 AM
Lucy´s answer (how to find best ADC step size) Raul Fajardo DSP 0 12-22-2004 10:42 AM


All times are GMT +1. The time now is 01:42 PM.


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