[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with using fft and ifft functions
From: |
Sergei Steshenko |
Subject: |
Re: Problem with using fft and ifft functions |
Date: |
Tue, 21 Jul 2009 18:13:41 -0700 (PDT) |
--- On Tue, 7/21/09, babelproofreader <address@hidden> wrote:
> From: babelproofreader <address@hidden>
> Subject: Problem with using fft and ifft functions
> To: address@hidden
> Date: Tuesday, July 21, 2009, 7:37 AM
>
[snip]
> when I use the functions fft and then ifft something seems
> to go wrong, but
> in my ignorance I can't figure out how to fix it, or even
> what is going
> wrong.
[snip]
Did I delete anything which describes what exactly went wrong ?
Or which describes why you think it went wrong ?
...
I haven't looked closely in your code, but a couple of quick tips:
1) 'octave' uses full complex FFT opposed, to say, typically used
half-complex ones;
2) because of the above direct FFT -> filter application -> inverse FFT
sequence produces ("slightly") complex results due to rounding errors.
So in 'octave' I typically do the following:
1) forcefully make second half of the spectrum to be complex conjugate of
the first (I mean the case of real, not complex, input signal);
2) apply filter to the first half of the spectrum;
3) again forcefully make second half of the spectrum to be complex
conjugate of the first;
4) perform inverse FFT;
4a) do a sanity check to make sure complex parts of the filtered signal
are small;
5) discard complex parts of the filtered signal - since mathematically
they should be zeros.
Regards,
Sergei.