forum.alglib.net

ALGLIB forum
It is currently Sat Apr 27, 2024 8:11 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to do a low pass filter to fft
PostPosted: Thu Jul 17, 2014 1:48 pm 
Offline

Joined: Thu Jul 17, 2014 11:16 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: How to do a low pass filter to fft
PostPosted: Fri Jul 18, 2014 7:30 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 906
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.


Top
 Profile  
 
 Post subject: Re: How to do a low pass filter to fft
PostPosted: Tue Jul 29, 2014 8:38 am 
Offline

Joined: Thu Jul 17, 2014 11:16 am
Posts: 3
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 :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 324 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group