Problem with FFT and IFFT back to time doman, not exactly the first signal.

13 views (last 30 days)
Hello all.
I am trying to reproduce the changes on a ~30 femtosecond laser pulse. I create and display this pulse in time just fine. Also, the fft of this pulse apperas fine on matlab (central frequency and width are very fine). But when I backtransform the transformed one using the ifft() function, the pulse is moved in time (posssibly due to phase change?? I don't know) and also the peak maxima are different.. What could be the cause of this? I am using ifft the wrong way?
The code I am using is this :
atto=1e-18;
c = 299792458;
femto=1e-15;
lamda0=800e-9;
f_0=c/lamda0;
omega0=2*pi*c/lamda0;
T=2*pi/omega0;
a=2*log(2)/((36.32*femto)^2);
Fs=3/atto; %samplying rate
t=-200*femto:1/Fs:200*femto;
Efield=exp(-a.*(t-T).^2).*exp(1j.*omega0.*(t-T));
nfft=2^nextpow2(length(Efield));
Efieldfft=fft(Efield,nfft);
f=(0:nfft-1)*Fs/nfft;
omega=2*pi*f;
figure(1)
plot(t,Efield)
xlabel('s [fs]')
ylabel('Amplitude')
figure(2)
plot(omega,abs(Efieldfft))
xlim([2e15 2.8e15])
xlabel('omega [rad]')
ylabel('Amplitude')
figure(3)
plot(f,abs(Efieldfft))
xlim([3.3e14 4.1e14])
xlabel('frequency [Hz]')
ylabel('Power')
test=ifft(Efieldfft,length(t));
figure(4)
plot(t,test)
xlabel('s[fs]')
ylabel('amplitude')
Test is the backtransformed function to time... Looking forward for your answers

Accepted Answer

SK
SK on 3 Oct 2014
You have padded the original function with zeros upto the next power of 2. But when you take the inverse fft you only use the length of the original function. You need to put the full length of the fft back into the ifft function.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering 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!