|
From: | ting xu |
Subject: | [Tftb-help] question about the energy function margtfr |
Date: | Tue, 18 Dec 2012 19:51:59 +0800 |
t=1:600; N=length(t);
ts=cos(2*pi*0.3*t')+3*cos(2*pi*0.1*t'); % for example here
f = (1:N/2)/N;
a = abs(fft(ts))/(N/2); a = a(1:N/2);
[wtfr,~,f_wt,~]=tfrscalo(ts,1:N,sqrt(N),0.001,0.5); % wavelet transform
% total Energy
fE = integ(a'.^2,f)*N
[~,~,wE] = margtfr(wtfr,t,f_wt)
idx_fft = find( f < 0.2, 1, 'last');
a_low = a(1:idx_fft); f_low = f(1:idx_fft);
fE_low = integ(a_low'.^2,f_low)*N
% low frequency Energy from wavelet
idx_wt = find( f_wt < 0.2, 1, 'last');
wtfr_low = wtfr(1:idx_wt,:); f_wt_low = f_wt(1:idx_wt);
[~,~,wE_low] = margtfr(wtfr_low, t, f_wt_low)
% In margtfr function, wE_low is calculated by the following equation
% wE_low = integ2d(wtfr_low, t, f_wt_low)/size(wtfr_low,1)
Specifically, Low frequency energy from wavelet (wE_low) does not equal to energy from fft (fE_low) . I check the function margtfr, E = real( integ2d ( tfr, t, f ) / M), M is the total number of frequency points of tfr matrix. then I changed the scripts like this
[M, N] = size(wtfr);
wE_low = integ2d(wtfr_low, t, f_wt_low)/M
[Prev in Thread] | Current Thread | [Next in Thread] |