# FIR Filter Help

Started by February 13, 2005
```Hi, I would like to apply a FIR filter to my frequency sample array.
Specifically, I want to use a band-pass filter against my data, but I'm
pretty new to DSP and I'm not sure exactly how to integrate this.

First, I have a complex array of frequency data (real, imaginary).

Second, I've used a FIR design program to come up with the following
information:

-Rectangular window FIR filter
-Filter type: BP
-Passband: 300 - 3000 Hz
-Order: 20
-Transition band: 368 Hz
-Stopband attenuation: 21 dB

-Coefficients:
a[0] =	-0.026050229
a[1] =	-0.038693827
a[2] =	0.008864745
a[3] =	-0.06381684
a[4] =	0.006034263
a[5] =	-0.028610367
a[6] =	-0.06422336
a[7] =	0.06343614
a[8] =	-0.16215464
a[9] =	0.14424528
a[10] =	0.68565154
a[11] =	0.14424528
a[12] =	-0.16215464
a[13] =	0.06343614
a[14] =	-0.06422336
a[15] =	-0.028610367
a[16] =	0.006034263
a[17] =	-0.06381684
a[18] =	0.008864745
a[19] =	-0.038693827
a[20] =	-0.026050229

Now, could someone please describe to me how I can use the above info.
and apply it to my freq. data? Thank you!

```
```Hi, I'm, assuming you know how to do a convolution - if not then you'll
have to look it up.

Now to filter your complex series you really do the same thing, except
that the multiplies and adds are now complex - you can think of you
filter as having a complex componentm but it is just set to zero.

Since you filter has just a real component, it gets even easier. In this
case you take the real part of the input data and apply your filter and
it becomes the real part of your output data. You take the imaginary
part of your input and apply the filter again (as if it were the real
part - drop the i notation) and you end up with the imaginary part of
your output. So you can just apply your filter twice to the real and
imaginary parts of the input data to produce the corresponding part of

Note: This is only possible because your filter has just a real
component. If it had a complex component you'd have to do the full

Hope that helps.

Cheers,
David

yeti349@yahoo.com wrote:
> Hi, I would like to apply a FIR filter to my frequency sample array.
> Specifically, I want to use a band-pass filter against my data, but I'm
> pretty new to DSP and I'm not sure exactly how to integrate this.
>
> First, I have a complex array of frequency data (real, imaginary).
>
> Second, I've used a FIR design program to come up with the following
> information:
>
> -Rectangular window FIR filter
> -Filter type: BP
> -Passband: 300 - 3000 Hz
> -Order: 20
> -Transition band: 368 Hz
> -Stopband attenuation: 21 dB
>
> -Coefficients:
> a[0] =	-0.026050229
> a[1] =	-0.038693827
> a[2] =	0.008864745
> a[3] =	-0.06381684
> a[4] =	0.006034263
> a[5] =	-0.028610367
> a[6] =	-0.06422336
> a[7] =	0.06343614
> a[8] =	-0.16215464
> a[9] =	0.14424528
> a[10] =	0.68565154
> a[11] =	0.14424528
> a[12] =	-0.16215464
> a[13] =	0.06343614
> a[14] =	-0.06422336
> a[15] =	-0.028610367
> a[16] =	0.006034263
> a[17] =	-0.06381684
> a[18] =	0.008864745
> a[19] =	-0.038693827
> a[20] =	-0.026050229
>
> Now, could someone please describe to me how I can use the above info.
> and apply it to my freq. data? Thank you!
>
```
```If you have frequency domain samples, you don't need the coefficients
of the FIR. You have specified:

"
-Rectangular window FIR filter
-Filter type: BP
-Passband: 300 - 3000 Hz
-Order: 20
-Transition band: 368 Hz
-Stopband attenuation: 21 dB
"

So all you do is attenuate the frequency samples that lie between 300
and 3000 Hz by 21 dB, et voila! Perhaps you might want to convert back
your frequency data into time domain data. I don't know.

The coefficients from the filter design program are only needed if you
want a time domain implementation of the FIR (that is, if your samples
are in time domain - but they are not, as you describe in your post).

Regards,
Andor

```
```> If you have frequency domain samples, you don't need the coefficients
> of the FIR. You have specified:

Yes, I can get all my time-domain samples to frequency samples using my
FFT.

> So all you do is attenuate the frequency samples that lie between 300
> and 3000 Hz by 21 dB, et voila! Perhaps you might want to convert
back
> your frequency data into time domain data. I don't know.

This is the essence of my question. I'm not exactly sure how to
attenuate... And yes I will be converting back to time-domain with my
inverse FFT.

> The coefficients from the filter design program are only needed if
you
> want a time domain implementation of the FIR (that is, if your
samples
> are in time domain - but they are not, as you describe in your post).

This is correct, thank you.

```
```Can I just apply a FIR filter in the time domain without even doing a
FFT? Is it faster in the time domain?

```
```yeti349@yahoo.com wrote:

> Can I just apply a FIR filter in the time domain without even doing a
> FFT?

Yes

< Is it faster in the time domain?

Sometimes. It's certainly simpler.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```> Sometimes. It's certainly simpler.

Hmm, too bad I had to get my FFT and iFFT working before I realized
that. :)

```
```is there a formula for filtering white noise from a time-domain signal?

```
```yeti349@yahoo.com wrote:

> is there a formula for filtering white noise from a time-domain signal?

White noise has a flat spectrum which is to sat, the noise power is
uniform across the passband. If the signal is concentrated in one or
more parts of the band, allowing only those parts to pass improves the
signal-to-noise ratio. When signal and noise occupy the same spectrum,
there's little to be done. Consider a soprano's aria a signal, and a
mewling child, noise. Imagine trying to suppress one of the voices on a
recording. Only the script writers on CSI know how.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```> Only the script writers on CSI know how.

haha! yes I agree...good show though.

Jerry, you seem to be a very helpful person in this forum. Could you
please explain to me (like you are describing something to a retarded
child) the simplest way I can apply a low-pass FIR in the time-domain?

If I understand correctly, I can apply a 3 tap filter on my samples
like so:

output[t]=a0*input[t+1]+a1*input[t]+a2*input[t-1];

Are a0-a2 the coefficiants that represent the frequencies I want to
filter?

When I apply this formula to my audio, the ouput has a lot of static
and is amplified. There doesn't seem to be any filtering however.

Are there other components, like dB or Gain that need to be applied to
this formula, or is that just for FFT filters?

It's very important to me that I can filter (low-pass/high-pass) in the
time-domain, but like I've said, I haven't made much progress with good
results. Thanks again!

```