1
$\begingroup$

as you know the Morlet Fucntion is given by: $\frac{1}{\sqrt{\pi f_b}}e^{\frac{-t^2}{f_b}}e^{j2\pi f_c}$
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?
enter image description here 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]);
$\endgroup$
  • $\begingroup$ Your first graph should be plotted in the time domain as the x-axis, instead of the frequency domain as stated in your code. $\endgroup$ – freak_warrior Feb 11 '14 at 15:51
  • $\begingroup$ I think that does not make any difference @freak-warrior $\endgroup$ – Electricman Feb 11 '14 at 19:50
  • $\begingroup$ The phase in the wavelet formula is missing a $t$ in the exponent, the transform is looking right. $\endgroup$ – Dr. Lutz Lehmann Feb 11 '14 at 22:41
3
$\begingroup$

If you approximate the Fourier transform

$$X(f)=\mathcal F(x)(f)=\int_{-\infty}^\infty x(t)\,e^{-2\pi j\,ft}\,dt$$

by the discrete Fourier transformation for by sampling on the time segment $[-T,T]$ as

$$X(f_n)\approx \sum_{k=-N}^{N-1} x(k\tau)\,e^{-2\pi j\,f_nk\tau}\,\tau=s[n]\,\tau$$

with $T=N\tau$, $f_n=n/(N\tau)=n/N*f_s=n/T$, $n=-N,...,N-1$, $s$ the result of FFT on the sampled $x$ sequence after shift, ...

then you have to multiply the result of the FFT method by $\tau=T/N=1/f_s$.

$\endgroup$
  • 1
    $\begingroup$ Oh this make sense now, do you mean the term 1/N which we must put behind the DFT? @lutzl $\endgroup$ – Electricman Feb 11 '14 at 19:56
  • $\begingroup$ In principle, yes. But the step size of the Riemann sums distributes the factor 1/N between the FFT and iFFT differently from the usual procedure. Here $dt=\tau=1/f_s$ and $df=f_s/N$. $\endgroup$ – Dr. Lutz Lehmann Feb 11 '14 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.