Hi All,
This post is a request for help using MatLab's wavelet toolbox.
I am trying to get my head around using the command line vs using 'wavemenu' to process some signals. For convenience, I will provide same code using one of the datasets provided with MatLab.
The signal is quite different from what I am using, but hopefully this will make it easier for others to recreate/use the below code.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
load leleccum
sig=leleccum;
[C,L]=wavedec(sig,12,'db10');
cD3 = detcoef(C,L,8);
[Ea, Ed] = wenergy(C, L);
%% At this point I use wavemenu to import 'sig' using the 'Wavelet 1-D' menu area. Settings = db 10 and level 12, I click 'Analyze' finally I use file>export to workspace>export all details ([d1;...;dn]).
% The data exported is saved the workspace as my_VAR_1
subplot(221)
plot(sig)
subplot(223)
plot(cD3)
axis tight
subplot(222)
plot(sig)
subplot(224)
plot(my_VAR_1(8, : ) )
axis tight
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The signals 'cD3' and those saved in my_VAR_1 are a different length. Plus when viewing the plots the pattern of change is clearly different.
It seems that I don't really understand what the command [C,L]=wavedec(sig,12,'db10'); is doing. Therefore I am hoping someone can help with the following questions:
1.) What is the difference between the two approaches I have displayed above?
2.) When using the wenergy command, I understand the Ea output, but I do not get the Ed. Please can someone explain? I would like to be able to state how much energy is in each component of the signal as a percentage. The Ed values do not add up to the equivalent of Ea, so I am a tad confused as to exactly what the values represent.
3.) Once I have understood the above points, how can I estimate the approximate frequencies of each component? I suspect this would be via the use of the scal2frq command, but I can't seem to get the command to work.
I would like to avoid the use of wavemenu so that I can automate the process to read multiple signals (I have further analysis to complete once I figured the above points out).
Thank you in advance for any help you can offer.
Regards Dan
This post is a request for help using MatLab's wavelet toolbox.
I am trying to get my head around using the command line vs using 'wavemenu' to process some signals. For convenience, I will provide same code using one of the datasets provided with MatLab.
The signal is quite different from what I am using, but hopefully this will make it easier for others to recreate/use the below code.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
load leleccum
sig=leleccum;
[C,L]=wavedec(sig,12,'db10');
cD3 = detcoef(C,L,8);
[Ea, Ed] = wenergy(C, L);
%% At this point I use wavemenu to import 'sig' using the 'Wavelet 1-D' menu area. Settings = db 10 and level 12, I click 'Analyze' finally I use file>export to workspace>export all details ([d1;...;dn]).
% The data exported is saved the workspace as my_VAR_1
subplot(221)
plot(sig)
subplot(223)
plot(cD3)
axis tight
subplot(222)
plot(sig)
subplot(224)
plot(my_VAR_1(8, : ) )
axis tight
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The signals 'cD3' and those saved in my_VAR_1 are a different length. Plus when viewing the plots the pattern of change is clearly different.
It seems that I don't really understand what the command [C,L]=wavedec(sig,12,'db10'); is doing. Therefore I am hoping someone can help with the following questions:
1.) What is the difference between the two approaches I have displayed above?
2.) When using the wenergy command, I understand the Ea output, but I do not get the Ed. Please can someone explain? I would like to be able to state how much energy is in each component of the signal as a percentage. The Ed values do not add up to the equivalent of Ea, so I am a tad confused as to exactly what the values represent.
3.) Once I have understood the above points, how can I estimate the approximate frequencies of each component? I suspect this would be via the use of the scal2frq command, but I can't seem to get the command to work.
I would like to avoid the use of wavemenu so that I can automate the process to read multiple signals (I have further analysis to complete once I figured the above points out).
Thank you in advance for any help you can offer.
Regards Dan