forum.alglib.net
http://forum.alglib.net/

How to do a low pass filter to fft
http://forum.alglib.net/viewtopic.php?f=2&t=2081
Page 1 of 1

Author:  mig00 [ Thu Jul 17, 2014 1:48 pm ]
Post subject:  How to do a low pass filter to fft

Hi,

I'm trying to do a fft, use a low pass filter and after that ifft to remove signal noise...

I dont know how to do it, because fft work with complex numbers, and the filters with double[] arrays. I was try to convert the number to decimal, filter, and do ifft, but the result is not good.

Anybody can help me, please.

If anybody have a sample i'm programming on C#, but i'm happy with any tip.

Thanks

Author:  Sergey.Bochkanov [ Fri Jul 18, 2014 7:30 am ]
Post subject:  Re: How to do a low pass filter to fft

Hello!

1. use fftr1d() to perform transform. This function transforms double[] array (temporal data) to complex[] (frequencies)
2. apply filtering to frequencies. You should know what kind of filter you need... Do not try to convert complex numbers to real ones at this stage! These numbers MUST be complex, these are amplitude/phase pairs. Just get formula for filter and apply it.
3. convert back with fftr1dinv() - it accepts complex frequencies and converts them to double[] array.

Author:  mig00 [ Tue Jul 29, 2014 8:38 am ]
Post subject:  Re: How to do a low pass filter to fft

Thanks Sergey.Bochkanov,

I did that steeps, but the problem, for me is the filter...

I was try to do a low pass, any like
for (int i = 0; i < datos.Length; i++)
{
// First i try with the module, but its some
//if ((Math.Sqrt(Math.Pow(datos[i].x,2)+Math.Pow(datos[i].y,2)) )<= filter) { // Math.Sqrt(Math.Pow(real,2)+Math.Pow(imaginary,2)) )
if ( datos[i].x<= filter) { // Compare only the real part
// That value is correct
}
else{
// The value is out the filter. Remove the value
datos[i].x= 0;
//datos[i].y= 0;
}
}

Please, help me with the filter, i'm stoned with the filter :(

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/