How can I set the coefficients in a Wavelet tree using an external variable?

I am trying to decompose a signal in a wavelet tree structure using the WPDEC function. For a specific bottom node on the tree, I want to then modify the coefficients and then reconstruct the tree. Is there a way I can modify the value and the number of coefficients in a wavelet tree?

 Accepted Answer

It is not possible to change the number of coefficients in any node in the wavelet tree. However, it is possible to change the value of coefficients in a wavelet tree using the read and write methods of the wavelet object.
Provided below is an example on how this can be achieved:
load noisdopp;
x = noisdopp;
% decompose x at depth 3 with db1 wavelet packets.
wpt = wpdec(x,3,'db1');
% plot wavelet packet tree wpt.
plot(wpt);
[wpt,cA,cD] = wpsplt(wpt,[3 0]);
plot(wpt);
%extract coefficients
cfs = read(wpt,'cfs',[3 1]);
% may modify cfs or create new values.
% suppress the approximation coefficients
newcfs = zeros(size(cfs)); % has to be same size
% reconstruct the wavelet packet tree
wpt = write(wpt,'cfs',[3 1],newcfs);
plot(wpt);
The following documentation link in R2007b has additional examples on using read and write methods on wavelet tree objects:
web([docroot '/toolbox/wavelet/apxb_ob4.html#132777'])

More Answers (0)

Products

Release

R14SP1

Community Treasure Hunt

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

Start Hunting!