[Eeglablist] Units in output of timefreq - wavelet normalization

Niko Busch niko.busch at gmail.com
Wed Aug 10 02:58:46 PDT 2016


Dear Makoto (and everyone who replied to me personally regarding this post),

thank you for your reply! I see that the result of the wavelet transform
inside the timefreq function is dependent on the length of the signal,
which in turn is dependent on the number of cycles and sampling rate.
However, simply dividing by the length of the wavelet does not seem to be
the solution either. I modified the code below by including a
"normalization factor", which currently is simply the length of the
wavelet. Dividing the wavelet transformed amplitudes by this factor gives
the right order of magnitude, but the results are still quite off. By
increasing the sampling rate or number of cycles, the results are even more
off. I believe we are on the right track, but something is still missing.
Do you have any ideas?

Cheers,
Niko

%% Create sine wave
clear all
D = 4;       % total signal duration in seconds.
sigD = 1;    % duration of the test oscillation within the signal.
F = 10;      % frequency of the test oscillationin Hz.
P = .25;     % Phase of the test oscillation. 2 pi radians = 360 degrees
srate = 256; % sampling rate, i.e. N points per sec used to represent sine
wave.
T = 1/srate; % sampling period, i.e. for this e.g. points at 1 ms intervals
t = [T:T:D]; % time vector.

sigpoints = length(t)/2 - (sigD*srate)/2:(length(t)/2 + (sigD*srate)/2)-1;
mysig = zeros(1,D*srate);
mysig(sigpoints) = sin(2*F*t(sigpoints)*pi+ 2*pi*P);

%% TF computation
ncycles = 4;

[wavelet,cycles,freqresol,timeresol] = dftfilt3(F, ncycles, srate);
normfactor = length(wavelet{1});

[tf, outfreqs, outtimes] = timefreq(mysig', srate, ...
    'cycles', ncycles, 'wletmethod', 'dftfilt3', 'freqscale', 'linear', ...
    'freqs', F);

%% Plot
figure; hold all
plot(t,mysig);
plot(outtimes./1000,abs(tf)./normfactor)
xlabel('Time (seconds)');
ylabel('Amplitude');
legend('input signal', 'wavelet result')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20160810/8582f485/attachment.html>


More information about the eeglablist mailing list