MATLAB Answers

Understanding the limitations of wmpdictionary function in MATLAB when using wavelets

조회 수: 5(최근 30일)
ahmed niri
ahmed niri 28 Sep 2016
Commented: ahmed niri 5 Oct 2016
Wanting to find signal similarities in a physiological signal, I have been using the matching pursuit algorithm. In this algorithm, one of the most important factors in determining the reconstruction and detection of a signals is the matching pursuit dictionary. In MATLAB, the function that determines the components of the dictionary is wmpdictionary.
Before creating the dictionary, I have created my own wavelet such that it could be part of the dictionary.
The code being used is the following
chan =1;
prem = 415;
deuxi = 531;
signal = array_data(:,chan);
component = transpose(array_data(prem:deuxi,chan)); % Component that we desire to detect
familyName = 'MyWAVE T2'; %Family of wavelet created
familyShortName = 'mywa2'; %Name used when called
familyWaveType = 1;
familyNums = '';
fileWaveName = 'mywa2.mat'; %File made fot the wavelet
mywa2 = component;
save mywa2 mywa2;
wavemngr('add',familyName,familyShortName,familyWaveType,familyNums,fileWaveName);
[LO_D,HI_D,LO_R,HI_R] = wfilters('mywa2');
wname = 'mywa2';
wavefun(wname,'plot',7);
a = findobj(gcf,'Type','axes');
axis(a,'tight');
%%PART3: MP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%Creating the dictionary %%%%%%%%%%%%%%%%%%%%%%
[mpdict,nbvect,lst,longs] = wmpdictionary(length(signal),'lstcpt',{{'mywa2',5}}); % Creating the dictionary
%%%%%%%%%%%%%%%%%%Using the wmpalg function for MP %%%%%%%%%%%%%%%%%%%%%%
[yfit,r,coeff,iopt,qual,X] = wmpalg('OMP',signal,mpdict, 'itermax', 10); % Performing the MP
When trying to execute this code, I get the following error:
Subscript indices must either be real positive integers or logicals.
Error in wextend (line 101)
x = x(I);
Error in dwt (line 72)
y = wextend('1D',dwtEXTM,x,lenEXT);
Error in wavedec (line 45)
[x,d] = dwt(x,Lo_D,Hi_D); % decomposition
Error in wmpdictionary (line 137)
[~,lon] = wavedec(zeros(N,1),level,cptname);
Error in Matching_and_pursuit (line 49)
[mpdict,nbvect,lst,longs] = wmpdictionary(length(signal),'lstcpt',{{'mywa2',5}}); % Creating the dictionary
Having received this error, I want to ask what are the limitation that have to be set for wavelets such that they could be used in the Matching pursuit dictionary?

  댓글 수: 0

로그인 to comment.

답변 수 (1)

Wayne King
Wayne King 4 Oct 2016
It does not appear that you are creating an orthogonal wavelet with the code above. Can you possibly attach this "component" vector
component = transpose(array_data(prem:deuxi,chan)); % Component that we desire to detect
you obtain from the above?
Orthogonal wavelets are characterized by discrete (FIR) filter pairs, not by a wavelet per se like the Morlet. So you really want a set of filters that collectively satisfy the required properties of an orthogonal wavelet. Just looking at your code, it doesn't appear you have that.

  댓글 수: 3

ahmed niri
ahmed niri 5 Oct 2016
Thank you for the reply. The component vector has an output of:
1.0e+03 *
Columns 1 through 12
-0.1310 -0.1013 -0.0480 0.0032 0.0506 0.0960 0.1324 0.1544 0.1430 0.1252 0.0748 0.0096
Columns 13 through 24
-0.0728 -0.1500 -0.2356 -0.2982 -0.3724 -0.4220 -0.4714 -0.5306 -0.6158 -0.6968 -0.7948 -0.9360
Columns 25 through 36
-1.1160 -1.2958 -1.4520 -1.5768 -1.6756 -1.7378 -1.7822 -1.7906 -1.7314 -1.5110 -1.0966 -0.5048
Columns 37 through 48
0.1784 0.8496 1.3916 1.7642 1.9732 2.0470 2.0470 2.0470 2.0470 2.0470 2.0254 1.9756
Columns 49 through 60
1.9306 1.8638 1.7604 1.6308 1.4880 1.3052 1.1062 0.9168 0.7478 0.5856 0.4400 0.3136
Columns 61 through 72
0.1784 0.0382 -0.1028 -0.2356 -0.3656 -0.4818 -0.5730 -0.6432 -0.7192 -0.7880 -0.8428 -0.8986
Columns 73 through 84
-0.9434 -0.9738 -0.9888 -0.9974 -0.9966 -0.9790 -0.9556 -0.9274 -0.8720 -0.8172 -0.7668 -0.7144
Columns 85 through 96
-0.6686 -0.6460 -0.6198 -0.6036 -0.5828 -0.5638 -0.5532 -0.5426 -0.5362 -0.5288 -0.5282 -0.5118
Columns 97 through 108
-0.5040 -0.4826 -0.4778 -0.4530 -0.4350 -0.4134 -0.3994 -0.3678 -0.3496 -0.3316 -0.3146 -0.2874
Columns 109 through 117
-0.2644 -0.2356 -0.2068 -0.1686 -0.1474 -0.1260 -0.1102 -0.1013 -0.0770
So appart from the initial creation of the wavelet, do I also have to create some filters to make all wavelet orthogonal?
Wayne King
Wayne King 5 Oct 2016
Yes, you have to a set of filters that makes an orthogonal wavelet. Discrete wavelet transforms do not proceed from the actual scaling functions or wavelets. They instead proceed from a set of FIR filters that define the scaling function and wavelet.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by