MATLAB: How to obtain the data in the Wavelet analysis plots

Wavelet Toolbox

I open up the wavelet Toolbox main menu and click on “Wavelet 1-D”. From the Wavelet 1-D GUI, I then navigate to File->Example Analysis->Basic Signals->"with db3 at level 5 -> Sum of sines". The analysis generates several plots for decomposition data. I want to save these data and perform further analysis in MATLAB.

Best Answer

The ability to directly save the a5, d5, d4, d3, d2, and d1 data is not available in the Wavelet Toolbox. You will need to first save the decomposition as a MAT-file and then reconstruct the data using the WRCOEF function in MATLAB. You can follow these steps:
1. From the “Wavelet 1-D” GUI, navigate to File->Save->Decomposition. Save the decomposition as a MAT-file, e.g., decomp.mat.
2. Use the WRCOEF function to reconstruct the coefficients. For example:
% load decomposition MAT file
load decomp.mat
a5 = wrcoef('a',coefs,longs,'db3',5);
d5 = wrcoef('d',coefs,longs,'db3',5);
d4 = wrcoef('d',coefs,longs,'db3',4);
d3 = wrcoef('d',coefs,longs,'db3',3);
d2 = wrcoef('d',coefs,longs,'db3',2);
d1 = wrcoef('d',coefs,longs,'db3',1);
3. Now plot a5, d5, d4, d3, d2, and d1. You will find that the plots are identical to the plots in the original “Wavelet 1-D” GUI.
subplot(611),plot(a5);
subplot(612),plot(d5);
subplot(613),plot(d4);
subplot(614),plot(d3);
subplot(615),plot(d2);
subplot(616),plot(d1);