how to make frequency vs. time figure in wavelet decomposition?
3 views (last 30 days)
Show older comments
Hi Matlab guru,
I was able to acquire my signal's detail coefficients by wavelet decomposition. But I don't know how to make the figure. I use an old version Matlab (7.0) with wavelet toolbox but no new functions like wpspectrum. So is there a way for me to make the figure? I understand that color scale indicates magnitude of the coefficients at each frequency-time block. I use the code below to acquire detail coefficients D1 - D8:
s=mysignal; %256 elements, Fs = 1Hz.
numlevels = wmaxlev(length(s), 'haar');
[C,L]= wavedec(s, numlevels, 'haar');
D1 = detcoef(C,L,1); D2 = detcoef(C,L,2); D3 = detcoef(C,L,3); D4 = detcoef(C,L,4); D5 = detcoef(C,L,5); D6 = detcoef(C,L,6); D7 = detcoef(C,L,7); D8 = detcoef(C,L,8);
[Ea,Ed] = wenergy(C,L);
%Make sure these two values are equal:
sum(D1.^2)+sum(D2.^2)+sum(D3.^2)+sum(D4.^2)+sum(D5.^2)+sum(D6.^2)+sum(D7.^2)+sum(D8.^2)+C(1)^2
sum(s.^2)
0 Comments
Accepted Answer
Wayne King
on 18 Oct 2011
Hi Shinchin, A couple things.
In your call to detcoef(), it is better to use.
dcell = detcoef(C,L,'cells');
to get all the detail coefficients with one line.
If you want to separate out your wavelet coefficients in approximate passbands, you can use the following approximation (which is not very good with the Haar wavelet by the way).
At level J, the wavelet coefficients approximate the output of a bandpass filter with passband [Fs/(2^(J+1)), Fs/2^J]
but you will have to space your wavelet coefficients correctly.
More Answers (1)
See Also
Categories
Find more on Discrete Multiresolution Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!