MATLAB: Proper wavelet scaling / restricted frequency analysis

frequency analysisscalingwaveletWavelet Toolbox

Dear all, I sample a signal with 20000 Hz and I'm using e.g. the morlet wavelet to analyze the frequency content of short time periods (e.g. 500 ms). Two questions: The scaling os correlated to the pseudo-freuency range of the wavelet transfrom. How can I determine the optimal scaling factor? I'm just interested in the frequency range of 100-300 Hz. Is there a possibility – e.g. through the factors – to focus the wavelet analyses on this frequency range? Looking forward to your advice. Best, Peter

Best Answer

Yes, it is possible, but you have to remember that the CWT is not as localized in frequency as the Fourier basis, so you have to give yourself some wiggle room. A sine wave will not be localized at one scale in the CWT. The way to do it best depends on whether you are using cwt.m or cwtft.m.
I'll create a signal consisting of 100-Hz and 300-Hz sine waves in noise. The 100-Hz signal will occur over the first 500 msec, the 300-Hz sine wave over the interval from 500 msec to 1 second.
Here is cwt.m:
fs = 2e4;
t = 0:1/fs:2-1/fs;
x = ...
2*cos(2*pi*100*t).*(t<0.500)+3*cos(2*pi*300*t).*(t>0.500 & t <1)+randn(size(t));
dt = 1/fs;
minscale = centfrq('morl')/(300*dt);
maxscale = centfrq('morl')/(100*dt);
scales = minscale-10:maxscale+10;
cfs = cwt(x,scales,'morl','plot');
Now for cwtft (using an analytic Morlet wavelet)
MorletFourierFactor = 4*pi/(6+sqrt(2+6^2));
s0 = (0.002*MorletFourierFactor);
smax = (1/100*MorletFourierFactor);
ds =0.2;
nb = ceil(log2(smax/s0)/ds+1);
scales = struct('s0',s0,'ds',0.5,'nb',nb,'type','pow','pow',2);
cwtS1 = cwtft({x,dt},'scales',scales,'wavelet','morl');
sc = cwtS1.scales;
freq = 1./(sc*MorletFourierFactor);
contour(t,freq,abs(cwtS1.cfs));
xlabel('Time'); ylabel('Pseudo-Frequency');