FFT vs. Morlet

原文

Comparing FFT and Morlets with different cycles

for i=0:4
figure;[ersp,itc,powbase,times,freqs]=...
newtimef( mysig,2000,[-500 1500],1000,i,'plotitc','off','erspmax',30);
end

Why Morlet

One advantage of wavelet analysis over a moving Fourier spectrum is that it the window size can be varied according to the frequency being analysed. This is best illustrated if we create a new signal in which there are bursts of increased amplitude at different time points for different frequencies.

make a complex wave

Here is a little routine that creates a signal with a 500 ms baseline, then bursts of increased power, each lasting 200 ms, at 0 ms, 400 ms and 800 ms post baseline, for frequencies 8 Hz, 25 Hz and 50 Hz.

D = 2; %signal duration 2s
S = 1000; % sampling rate, i.e. N points pt sec used to represent sine wave
F = [8 25 40]; % 4 frequencies in Hz
w = 2*pi*F; % convert frequencies to radians
P = [0 0 0]; % 4 corresponding phases
T = 1/S; % sampling period, i.e. for this e.g. points at 1 ms intervals
t = [T:T:D]; % time vector %corrected from previous version
nfreqs=length(F); % N frequencies in the complex
A=ones(nfreqs,length(t)); %amplitudes initialised at one
A(1,500:700)=3; %boost of increased amplitude at each time pt, nb 500 corresponds to end of baseline period
A(2,900:1100)=3;
A(3,1300:1500)=3;
% Add all sine waves together to give composite
for thispt=1:2000
for thisfreq=1:nfreqs
mysig(thisfreq,thispt) =A(thisfreq,thispt)*sin(w(thisfreq)*t(thispt));
end
end
mysig2=sum(mysig,1);
t=t-.5; %subtract 500 ms to indicate baseline is negative
figure; plot(t,mysig2);
xlabel('Time (seconds)');
ylabel('Amplitude');

FFT and Morlet wavelets

for i=0:3
% First plot ERSP with constant values of cycles
scrsz = get(0,'ScreenSize'); %used to adjust figure size; not normally needed
figure('Position',[1 scrsz(4)/4 scrsz(3)/2 scrsz(4)/4])
[ersp,itc,powbase,times,freqs]=...
newtimef( mysig2,2000,[-500 1500],1000,i,'plotitc','off', 'erspmax',30);
end

This time, the number of cycles used varies with the frequency being analysed. The differences between settings with this sample waveform are not huge, but nevertheless, it should be possible to see that there are advantages in specifying a range of cycles if you want to inspect ERSP over a wide frequency range.

Last updated