One definition of the Morlet wavelet function is given by:
$$\frac{1}{\sqrt{\pi f_b}}e^{\frac{-t^2}{f_b}}e^{j2\pi f_c t}$$
The Fourier transform of this equation is: $e^{-\pi^2 f_b(f-f_c)^2}$ (is it right)?
First I attempted to plot the FFT of Morlet function by FFT
function in Matlab, then I've plotted the Fourier transform function directly. I've expected to see same plots, but unfortunately they have different magnitude (why?). I publish the plot and my codes, do you have any idea why this happened? Is there any problem in my codes? Or any problem in the obtained Fourier transform? Or any problem in Matlab built-in FFT
function?
I wrote this script to get those plots:
clear all;
fS = 500;
tStart= -4;
tStop= 4;
timeVector = linspace(tStart,tStop, (tStop-tStart)*fS );
fC = 2;
fB=2;
timeMask = zeros(1,length(timeVector));
timeMask((timeVector >= -fB/2) & (timeVector <= fB/2)) = 1;
psiWavelet = ((pi*fB))^(-0.5).*... % Morlet function
exp(2*1i*pi*fC.*timeVector).*exp(-timeVector.^2/fB); % Morlet function
% FFT plot by matlab bulit-in FFT function
Nfft =10*2^nextpow2(length(timeVector));
FFT =fftshift(abs(fft(psiWavelet,Nfft)));
freqs=[0:Nfft - 1].*(fS/Nfft);
freqs(freqs >= fS/2) = freqs(freqs >= fS/2) - fS;
freqs=fftshift(freqs);
figure(2);
subplot(1,2,1)
plot(freqs, FFT);
xlim([-1 5]);
xlabel('Frequency / Hz');
title (sprintf('Fourier Transform'));
% FFT plot by its direct fourier transfrom function
f_psi=exp(-(pi^2*fB)*(freqs-fC).^2);
subplot(1,2,2)
plot(freqs,f_psi)
xlim([-1 5]);