<div dir="ltr"><span style="color:rgb(0,0,0);font-size:12.8px">Hi everyone, </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">can you help me understand the output of the </span><span class="" style="color:rgb(0,0,0);font-size:12.8px">timefreq</span><span style="color:rgb(0,0,0);font-size:12.8px"> function? The main output is "tf", and abs(tf) is a measure of spectral power. But what exactly do the units of tf represent? </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">Below, I attach a simple script that simulates a synthetic oscillation of known frequency and amplitude. Using </span><span class="" style="color:rgb(0,0,0);font-size:12.8px">timefreq</span><span style="color:rgb(0,0,0);font-size:12.8px"> 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. </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">So, what do values in tf represent and how should I "normalize" these values to match the amplitude of the input signal? </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">Thanks, </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">Niko </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">%% Create sine wave </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">clear all </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">D = 4;       % total signal duration in seconds. </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">sigD = 1;    % duration of the test oscillation within the signal. </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">F = 10;      % frequency of the test oscillationin Hz. </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">P = .25;     % Phase of the test oscillation. 2 pi radians = 360 degrees </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">srate = 256; % sampling rate, i.e. N points per sec used to represent sine wave. </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">T = 1/srate; % sampling period, i.e. for this e.g. points at 1 ms intervals </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">t = [T:T:D]; % </span><span class="" style="color:rgb(0,0,0);font-size:12.8px">time</span><span style="color:rgb(0,0,0);font-size:12.8px"> vector. </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">sigpoints = length(t)/2 - (sigD*srate)/2:(length(t)/2 + (sigD*srate)/2)-1; </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">mysig = zeros(1,D*srate); </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">mysig(sigpoints) = sin(2*F*t(sigpoints)*pi+ 2*pi*P); </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">%% TF computation </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">[tf, outfreqs, outtimes] = </span><span class="" style="color:rgb(0,0,0);font-size:12.8px">timefreq</span><span style="color:rgb(0,0,0);font-size:12.8px">(mysig', srate, ... </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">    'cycles', 4, 'wletmethod', 'dftfilt3', 'freqscale', 'linear', ... </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">    'freqs', F); </span><br style="color:rgb(0,0,0);font-size:12.8px"><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">%% Plot </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">figure; hold all </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">plot(t,mysig); </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">plot(outtimes./1000,abs(tf)) </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">xlabel('</span><span class="" style="color:rgb(0,0,0);font-size:12.8px">Time</span><span style="color:rgb(0,0,0);font-size:12.8px"> (seconds)'); </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">ylabel('Amplitude'); </span><br style="color:rgb(0,0,0);font-size:12.8px"><span style="color:rgb(0,0,0);font-size:12.8px">legend('input signal', 'wavelet result') </span><br></div>