MATLAB Answers


One dimensional discrete wavelet analysis - How to code it

Asked by Renaldo
on 18 Sep 2013


I am using the Wavelet design and analysis package for signal processing, specifically the Wavelet 1-D package. The GUI makes it very easy to use and I can break my signal down easily into approximations and details, and can export it easily to the workspace and use it from there.

My issue is, I need to automate the process, so Im trying to write a script that does the whole thing for me, using the swt() function.

Is that the right approach?

For example, in the GUI, I select the level to be 7 and I use db 10.

My code is then

[approximations, details] = swt(zoom_proc, wavelet_level, 'db10');

where zoom_proc is the signal I am using (it's length is correct for swt)

But, the data is completely different from that which I get in the GUI?

Any ideas?




No products are associated with this question.

1 Answer

Answer by Renaldo
on 19 Sep 2013
 Accepted answer

I managed to sort this out. You cannot use swt() to recreate the results from the GUI as I mentioned. You need to use wavedec() and wrcoef(). This is my code: (zoom_proc is the data set)

[C, L] = wavedec(zoom_proc, wavelet_level, 'db10');

approximations = zeros(wavelet_level, zoom_array_length); details = zeros(wavelet_level, zoom_array_length);

for i = 1:1:wavelet_level approximations(i, :) = wrcoef('a',C,L,'db10', i); details(i, :) = wrcoef('d',C,L,'db10', i); end


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!