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, 10:02 PM
Moodz
Guest
 
Posts: n/a
Default IIR filter Coefficients in Q15 format with Q15 data

Hi,

I am trying to implement a low pass IIR filter with data range of +1 & -1
The filter coefficients I get from Matlab are greater than 1. So, I need t
scale down all coefficients, that makes a(1) coefficient not equal to 1 an
makes the time difference equation to be:

y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
-a(2)*y(m-1)-....-a(na)*y(na-1) ]

This multiplication of 1/a(1) is a number greater than 1, that I can no
allow in the system. How can I get around this problem? I need to keep al
data within +1 & -1 format and I am using Q15 binary format fo
implementation of the filter.
It might sound a stupid question but any help is appreciated.

Thanks

Moodz


Reply With Quote
  #2 (permalink)  
Old 07-07-2007, 10:24 PM
Jerry Avins
Guest
 
Posts: n/a
Default Re: IIR filter Coefficients in Q15 format with Q15 data

Moodz wrote:
> Hi,
>
> I am trying to implement a low pass IIR filter with data range of +1 & -1.
> The filter coefficients I get from Matlab are greater than 1. So, I need to
> scale down all coefficients, that makes a(1) coefficient not equal to 1 and
> makes the time difference equation to be:
>
> y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
> -a(2)*y(m-1)-....-a(na)*y(na-1) ]
>
> This multiplication of 1/a(1) is a number greater than 1, that I can not
> allow in the system. How can I get around this problem? I need to keep all
> data within +1 & -1 format and I am using Q15 binary format for
> implementation of the filter.
> It might sound a stupid question but any help is appreciated.


Can you get half the correct result? If so, double when you're finished.
(Use r + r instead of 2*r to avoid multiplying.)

Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply With Quote
  #3 (permalink)  
Old 07-07-2007, 10:25 PM
Ali
Guest
 
Posts: n/a
Default Re: IIR filter Coefficients in Q15 format with Q15 data

On Jul 7, 4:02 pm, "Moodz" <nov_rain1...@yahoo.com> wrote:
> Hi,
>
> I am trying to implement a low pass IIR filter with data range of +1 & -1.
> The filter coefficients I get from Matlab are greater than 1. So, I need to
> scale down all coefficients, that makes a(1) coefficient not equal to 1 and
> makes the time difference equation to be:
>
> y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
> -a(2)*y(m-1)-....-a(na)*y(na-1) ]
>
> This multiplication of 1/a(1) is a number greater than 1, that I can not
> allow in the system. How can I get around this problem? I need to keep all
> data within +1 & -1 format and I am using Q15 binary format for
> implementation of the filter.
> It might sound a stupid question but any help is appreciated.
>
> Thanks
>
> Moodz


Is there a reason you do not precalculate the coefficients and then
put them in your system? This way everything is going to be smaller
than one and you don't need to multiply in realtime.

Hope this helps,
Ali

Reply With Quote
  #4 (permalink)  
Old 07-07-2007, 10:34 PM
Randy Yates
Guest
 
Posts: n/a
Default Re: IIR filter Coefficients in Q15 format with Q15 data

"Moodz" <[email protected]> writes:

> Hi,
>
> I am trying to implement a low pass IIR filter with data range of +1 & -1.
> The filter coefficients I get from Matlab are greater than 1. So, I need to
> scale down all coefficients, that makes a(1) coefficient not equal to 1 and
> makes the time difference equation to be:
>
> y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
> -a(2)*y(m-1)-....-a(na)*y(na-1) ]
>
> This multiplication of 1/a(1) is a number greater than 1, that I can not
> allow in the system. How can I get around this problem? I need to keep all
> data within +1 & -1 format and I am using Q15 binary format for
> implementation of the filter.
> It might sound a stupid question but any help is appreciated.
>
> Thanks
>
> Moodz


First of all, if your filter gain is higher than 1, you're not going
to get an output signal with the same range as the input signal. It
can't be done.

If your filter gain is 1 or less, then you can allow coefficients
greater than 1 in your filter - you just have to scale them and the
intermediate results properly.
--
% Randy Yates % "Rollin' and riding and slippin' and
%% Fuquay-Varina, NC % sliding, it's magic."
%%% 919-577-9882 %
%%%% <[email protected]> % 'Living' Thing', *A New World Record*, ELO
http://home.earthlink.net/~yatescr
Reply With Quote
  #5 (permalink)  
Old 07-08-2007, 01:44 PM
John
Guest
 
Posts: n/a
Default Re: IIR filter Coefficients in Q15 format with Q15 data

On Jul 7, 4:02 pm, "Moodz" <nov_rain1...@yahoo.com> wrote:
> Hi,
>
> I am trying to implement a low pass IIR filter with data range of +1 & -1.
> The filter coefficients I get from Matlab are greater than 1. So, I need to
> scale down all coefficients, that makes a(1) coefficient not equal to 1 and
> makes the time difference equation to be:
>
> y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
> -a(2)*y(m-1)-....-a(na)*y(na-1) ]
>
> This multiplication of 1/a(1) is a number greater than 1, that I can not
> allow in the system. How can I get around this problem? I need to keep all
> data within +1 & -1 format and I am using Q15 binary format for
> implementation of the filter.
> It might sound a stupid question but any help is appreciated.
>
> Thanks
>
> Moodz


If you have a coefficient c > 1, split it into two pieces c1 + c2 == c
and do two MACs.

John

Reply With Quote
  #6 (permalink)  
Old 07-08-2007, 08:31 PM
Tim Wescott
Guest
 
Posts: n/a
Default Re: IIR filter Coefficients in Q15 format with Q15 data

On Sat, 07 Jul 2007 15:02:48 -0500, Moodz wrote:

> Hi,
>
> I am trying to implement a low pass IIR filter with data range of +1 & -1.
>
> The filter coefficients I get from Matlab are greater than 1. So, I need to
>
> scale down all coefficients, that makes a(1) coefficient not equal to 1 and
>
> makes the time difference equation to be:
>
> y(m)= 1/a(1) * [b(1)*x(m) + b(2)*x(m-1) + ... + b(nb)*x(nb-1)
> -a(2)*y(m-1)-....-a(na)*y(na-1) ]
>
> This multiplication of 1/a(1) is a number greater than 1, that I can not
>
> allow in the system. How can I get around this problem? I need to keep all
>
> data within +1 & -1 format and I am using Q15 binary format for
>
> implementation of the filter.
> It might sound a stupid question but any help is appreciated.
>

First, be sure to split your filter into a cascaded set of 1st-order and
resonant 2nd-order filters -- the effects of rounding and coefficient
errors is pretty bad as you go beyond a 2nd-order filter.

If you do this, you'll find that none of your denominator coefficients
approaches 2. At this point you can take Jerry's suggestion of
calculating x(n)/2 and doubling it, or John's suggestion of doing the MAC
twice on one coefficient. You could also consider coding it to work with
1 + a(n). Each of these has their advantages and drawbacks, so you'll
want to look hard at the correct result.

--
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
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
Calculating filter coefficients from magnitude squared filter [email protected] DSP 2 06-29-2007 07:46 PM
FIR filter coefficients - are they ever zero?? elp02rap DSP 5 08-16-2005 08:30 PM
what are coefficients of a filter?? [email protected] DSP 4 03-24-2005 12:09 AM
simple programs to deal with data format, data synchronisation Ram VHDL 1 02-24-2005 06:34 PM
FIR Lattice Filter Reflection Coefficients in Terms of Direct Coefficients? Randy Yates DSP 11 11-02-2004 05:50 AM


All times are GMT +1. The time now is 02:55 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