<div dir="ltr"><div><div><div>Dear Makoto (and everyone who replied to me personally regarding this post),<br><br></div>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?<br><br></div>Cheers,<br></div>Niko<br><div><div><br>%% Create sine wave<br>clear all<br>D = 4;       % total signal duration in seconds.<br>sigD = 1;    % duration of the test oscillation within the signal.<br>F = 10;      % frequency of the test oscillationin Hz.<br>P = .25;     % Phase of the test oscillation. 2 pi radians = 360 degrees<br>srate = 256; % sampling rate, i.e. N points per sec used to represent sine wave.<br>T = 1/srate; % sampling period, i.e. for this e.g. points at 1 ms intervals<br>t = [T:T:D]; % time vector.<br><br>sigpoints = length(t)/2 - (sigD*srate)/2:(length(t)/2 + (sigD*srate)/2)-1;<br>mysig = zeros(1,D*srate);<br>mysig(sigpoints) = sin(2*F*t(sigpoints)*pi+ 2*pi*P);<br><br>%% TF computation<br>ncycles = 4;<br><br>[wavelet,cycles,freqresol,timeresol] = dftfilt3(F, ncycles, srate);<br>normfactor = length(wavelet{1});<br><br>[tf, outfreqs, outtimes] = timefreq(mysig', srate, ...<br>    'cycles', ncycles, 'wletmethod', 'dftfilt3', 'freqscale', 'linear', ...<br>    'freqs', F);<br><br>%% Plot<br>figure; hold all<br>plot(t,mysig); <br>plot(outtimes./1000,abs(tf)./normfactor)<br>xlabel('Time (seconds)');<br>ylabel('Amplitude');<br>legend('input signal', 'wavelet result')<br><br></div></div></div>