Scaling a function (wavelet)

2 visualizaciones (últimos 30 días)
Jakob Sørensen
Jakob Sørensen el 16 de Mayo de 2013
Hi there,
I got a function descriped as follows:
t = linspace(-3, 3 1024); % Time vector from -3s to 3s with 1024 points
y = (1./(1+t.^(2.^4))).*cos(20*t); % Enveloped cosine function
Now this is a wavelet, that I need to use as a mother wavelet. I now need scaled versions of it. Meaning Half duration, double frequency for each scale. Like this:
Scale: Freq: Duration:
1 20 -3.0:3.0 [s]
2 40 -1.5:1.5 [s]
3 80 -.75:.75 [s]
...etc
You probably get the point now. I tried this:
wavDur = 3/2^(m-1); % Half duration [s]
t = linspace(-wavDur, wavDur,round(2*wavDur*fs)); % Time vector
wavelet = (1./(1+t.^(2.^4))).*cos(20*t*2^(m-1)); % Scale dep. wavelet
Where m is the scale going from 1:12 atm. However this does not work. Most likely it has something to do with the envelope not scaling accordingly. Is there an easier way of scaling a signal the way I would like to? Basically its just a compression in time for each scale step.
  1 comentario
Jakob Sørensen
Jakob Sørensen el 16 de Mayo de 2013
Okay, as I read my own question i realized that I was quite far from the optimal method. My new code is like this
for m = scales
for n = 0:99
tScale = 2^(m-1); % Time scale factor: 2, 4, 8, 16...
tShift = 0.01*n*tScale; % Time shift factor [s]
% Calculate the scaled and shiftet wavlet
wavelet = (1./(1+(tScale*t-tShift).^4)).*cos(20*(tScale*t-tShift));
% Calculate lag zero crosscorrelaton
zeroCorr = signal*wavelet';
% Insert into coefficient matrix
coefs(m,n+1) = zeroCorr;
end
end
Scales is equal to 1:10 and n is just the time delay. Can someone tell me if this is correct? It seem to create the correct signals.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Continuous Wavelet Transforms en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by