ΣSigmaStudio Ask AI Русский Log in

Simple example of FIR filter

SigmaDSP & SigmaStudio ADIApproved Mar 24, 2011 00:00 4 replies Original on forum ↗
Subscribe
ADIApproved Question
Mar 24, 2011 00:00

I received a question about how to implement an FIR filter. Here's a very simple example.

NOTE: Most images are taken from Wikipedia's article on FIR filters: http://en.wikipedia.org/wiki/Finite_impulse_response

Here's what an FIR filter architecture looks like. The bn values are the multipliers for each filter tap.

Here's an example of a moving average filter, which uses three taps, each of which has a coefficient of 1/3.

The expected frequency response is shown here. The derivation can be found on Wikipedia's article.

I implemented a simple stereo FIR in SigmaStudio. I included the Stimulus and Probe cells so we could see the frequency response.

In the Table Editor, I entered in 0.33333 for each coefficient. It's probably better to use as many decimal places as possible for the best precision, but this is just a basic example.

By clicking the Probe and Stimulus windows, we can see that the frequency response matches the theoretical response.

SigmaStudio does not have its own FIR coefficient generation tool, but if you generate coefficients in another piece of software, just enter them directly into the Table Editor in SigmaStudio to realize that filter on the SigmaDSP hardware.

filter

sigmastudio

fir

SigmaDSP

7762.2e1a4c2cd926fe16cf78054186998342.jpg
7762.2e1a4c2cd926fe16cf78054186998342.jpg
7762.2e1a4c2cd926fe16cf78054186998342.jpg-316x212.jpg
7762.2e1a4c2cd926fe16cf78054186998342.jpg-316x212.jpg
4857.5ea276eba0a2242748bc768495855ac4.jpg
4857.5ea276eba0a2242748bc768495855ac4.jpg
4857.5ea276eba0a2242748bc768495855ac4.jpg-319x206.jpg
4857.5ea276eba0a2242748bc768495855ac4.jpg-319x206.jpg
5224.85042ff1b8abd2a43259cc68a20c3cbc.jpg
5224.85042ff1b8abd2a43259cc68a20c3cbc.jpg
5224.85042ff1b8abd2a43259cc68a20c3cbc.jpg-450x366.jpg
5224.85042ff1b8abd2a43259cc68a20c3cbc.jpg-450x366.jpg
6036.ce7f861a0a092628f7e52482bc7f3ac6.jpg
6036.ce7f861a0a092628f7e52482bc7f3ac6.jpg
6036.ce7f861a0a092628f7e52482bc7f3ac6.jpg-450x174.jpg
6036.ce7f861a0a092628f7e52482bc7f3ac6.jpg-450x174.jpg
8304.dd9245adb31773764022a6686d86964f.jpg
8304.dd9245adb31773764022a6686d86964f.jpg
8304.dd9245adb31773764022a6686d86964f.jpg-355x305.jpg
8304.dd9245adb31773764022a6686d86964f.jpg-355x305.jpg
5488.424ea7b28024017bf89ee07c26ec259c.jpg
5488.424ea7b28024017bf89ee07c26ec259c.jpg
5488.424ea7b28024017bf89ee07c26ec259c.jpg-450x313.jpg
5488.424ea7b28024017bf89ee07c26ec259c.jpg-450x313.jpg
leonxp Reply
Feb 20, 2013 00:00

Hi Brett, very nice tutorial.

I've an issue. I need to implement FIR filter to achive an optimal filtering based on an inverse frequency response of a loudspeaker. I compute filter coefficients with Matlab, with fir2 function. Some coefficients I get, are greater than DSP limit number representation (16.0) and SigmaStudio gives me an error, obviously. I wonder what should be a solution to this issue.
Thanks to all, bye

Leonardo.

ADIApproved Reply
Feb 20, 2013 00:00

I'm not sure if there is an easy way to get around the limits of number representation. Anything above 15.99999 will saturate, which effectively breaks the filter response.

I will forward this to the software team to see if they have any ideas for a workaround.

ADIApproved Reply
Feb 20, 2013 00:00

Hi leonxp,

Here is the response from one member of the software team:

Option 1, use Matlab fixed point toolbox:

http://www.mathworks.com/help/dsp/examples/working-with-fixed-point-direct-form-fir-filters.html

Or if they don't have that available normalize, see this discussion:

http://www.dsprelated.com/showmessage/118528/1.php

leonxp Reply
Feb 20, 2013 00:00

Thanks Brett!