MATLAB Answers

Understanding the limitations of wmpdictionary function in MATLAB when using wavelets

6 ビュー (過去 30 日間)
ahmed niri
ahmed niri 2016 年 9 月 28 日
コメント済み: ahmed niri 2016 年 10 月 5 日
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?

回答 (1 件)

Wayne King
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 件のコメント
ahmed niri
ahmed niri 2016 年 10 月 5 日
Thanks a lot Wayne I will try this.

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by