Why ifft results of analytic signal spectrum don't match with theoretical time formula?

1 view (last 30 days)
Dear all,
I need to convert a spectrum data back to time domain. Before it, I use a simple Gaussian pulse as a test. However, I found that results computed by ifft don't match with theoretical time equation. Why it happened? How to resolve it?
Fs=200;
T=1/Fs;
L=1200;
tau=0.4;
t0=2.8;
mag=10;
t=(0:L-1)*T;
f=Fs*(-L/2:L/2-1)/L;
Xf=@(x)sqrt(pi).*mag.*tau.*exp(-(2.*pi.*tau.*x).^2).*exp(-1i.*2.*pi.*x.*t0);
figure;
plot(f,real(Xf(f)));
% shift spectrum starting from 0 frequency
signal_comp=ifft(fftshift(Xf(f)).*L);
signal_theoretical=mag.*exp(-(t-t0).^2/tau^2);
figure;
plot(t,signal_theoretical);
hold on;
plot(t,real(signal_comp),'r--');

Accepted Answer

Matt J
Matt J on 22 Sep 2022
Edited: Matt J on 22 Sep 2022
The IFFT and the continuous inverse Fourier transform are not the same thing.
tau=0.4;
t0=2.8;
mag=10;
Fs=200;
dT=1/Fs;
L=2000;
dF=1/dT/L;
f=dF*(-L/2:L/2-1);
t=dT*(-L/2:L/2-1);
Xf=@(x)sqrt(pi).*mag.*tau.*exp(-(2.*pi.*tau.*x).^2).*exp(-1i.*2.*pi.*x.*t0);
% shift spectrum starting from 0 frequency
signal_comp= fftshift(ifft(ifftshift(Xf(f))) ) /dT; %note factor of 1/dT
signal_theoretical=mag.*exp(-((t-t0)/2).^2/tau^2)/2; %fix the theoretical formula
figure;
plot(t(1:20:end),signal_theoretical(1:20:end),'o',...
t,real(signal_comp),'r--');
legend('Theoretical','Computed',location='northwest')
  1 Comment
Jiali
Jiali on 24 Sep 2022
Thank you for your clarification! I do have misunderstanding between discrete Fourier transform and continuous Fourier transform although the concepts were taught before.

Sign in to comment.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!