How can I do Fourier transform of a function using FFT , keeping information of both the amplitude and phase ??
Show older comments
In general when FFT is used to evaluate the fourier transform, only the absolute value is plotted. The phase after performing the FFT turns out to be oscillatory. I am looking for a way to use FFT on various functions to evaluate the fourier transform.
E.g: fourier transform of the function f(x)=(x-1)^2 Exp(-x^2) for simplicity.
Answers (1)
Youssef Khmou
on 6 Feb 2013
Hi, Avinash, you can use this function :
function z=Fast_Fourier_Transform(x,nfft)
N=length(x);
z=zeros(1,nfft);
Sum=0;
for k=1:nfft
for jj=1:N
Sum=Sum+x(jj)*exp(-2*pi*j*(jj-1)*(k-1)/nfft);
end
z(k)=Sum;
Sum=0;% Reset
end
But the function is slow whith long signals ,so you can try my submission : http://www.mathworks.com/matlabcentral/fileexchange/40002-psd-power-spectral-density-and-amplitude-spectrum-with-adjusted-fft
2 Comments
Avinash Rustagi
on 6 Feb 2013
Youssef Khmou
on 6 Feb 2013
Edited: Youssef Khmou
on 6 Feb 2013
in the submission, the fft built-in is the core, but the functions computes nfft and give exact frequencies by adjusting frequency axis and amplitudes .
Ok anyway we wait for better answer .
Categories
Find more on Discrete Fourier and Cosine Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!