Clear Filters
Clear Filters

Understanding the limitations of wmpdictionary function in MATLAB when using wavelets

1 view (last 30 days)
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;
[LO_D,HI_D,LO_R,HI_R] = wfilters('mywa2');
wname = 'mywa2';
a = findobj(gcf,'Type','axes');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%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?

Answers (1)

Wayne King
Wayne King on 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.
Wayne King
Wayne King on 5 Oct 2016
Edited: Wayne King on 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!