On Dec 18, 2007, at 8:01 AM, Ben Abbott wrote: On Dec 17, 2007, at 5:39 PM, Gastón Araguás wrote:
i hope someone can help, thanks in advanced
Gastón
At 1st glance, I noticed a problem. You used the following to represent the derivative of "f" (I've modified it slightly).
fp = ifft ( ( 2i * pi * m ) * fft( f ) );
which is correct for continuous signals with infinite limits (Fourier Transform). However, for FFT's the signals are discrete & periodic (Discrete Fourier Transforms). So the derivative must be periodic as well. I haven't gone through all the details, but the result should look something like
fp = 1i * ifft ( sin ( 2 * pi * m ) .* fft ( f ) );
I'm likely off by some scale factor, but you get the idea, yes?
Ben
Ozzy is correct, a sawtooth is needed.
Here's some sample code for evaluating the spectral derivative, "fp", of a vector "f", using the FFT
N = numel(f); n = 0:(N-1); Df = 1i * fftshift (n-N/2); % discrete differential operator for "f" fp = ifft ( D.*fft (f));
Ben |