[Eeglablist] Units in output of timefreq

Niko Busch niko.busch at gmail.com
Wed Aug 3 10:25:13 PDT 2016

Hi everyone,

can you help me understand the output of the timefreq function? The main
output is "tf", and abs(tf) is a measure of spectral power. But what
exactly do the units of tf represent?

Below, I attach a simple script that simulates a synthetic oscillation of
known frequency and amplitude. Using timefreq on this signal, I would
expect the values of abs(tf) to match the amplitude of that oscillation.
But as you see, the values are orders of magnitude larger than the
amplitude of the oscillation. Furthermore, I notice that the magnitude of
the values in tf depends on the sampling frequency of the input signal and
the number of wavelet cycles.

So, what do values in tf represent and how should I "normalize" these
values to match the amplitude of the input signal?


%% 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
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
[tf, outfreqs, outtimes] = timefreq(mysig', srate, ...
    'cycles', 4, 'wletmethod', 'dftfilt3', 'freqscale', 'linear', ...
    'freqs', F);

%% Plot
figure; hold all
xlabel('Time (seconds)');
legend('input signal', 'wavelet result')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20160803/973dd86f/attachment.html>

More information about the eeglablist mailing list