Understanding the limitations of wmpdictionary function in MATLAB when using wavelets
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Wayne King
2016-10-4
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 个评论
Wayne King
2016-10-5
编辑:Wayne King
2016-10-5
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Continuous Wavelet Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!