How to get a Daubechies4 discrete wavelet transform MATRIX?

15 views (last 30 days)
I need a matrix that when I multiply it with X, gives me the coefficients of X in wavelet domain. It means that this matrix contains wavelet bases so that I can expand my signal with them. And this wavelet should be Daubechies4 ('Daubechies',4).
Coefficients=(Wavelet_Matrix)*X;
X=(Wavelet_Matrix)'*(Coefficients);
---------------------------------------------------------------------
There is a toolbox for this purpose called "Wavelab850". By using this toolbox I should write:
%http://ccm.ucdenver.edu/wiki/How_to_get_started_with_wavelets_and_Wavelab
n=256;
qmf= MakeONFilter('Daubechies',4) ;
XI=eye(n);W=zeros(n);for i=1:n,W(:,i)=FWT_PO(XI(:,i),1,qmf);end
------------------------------------------------------------------
But this Error happens:
Error using reverse (line 35)
First argument must be a string array, character vector, or cell array of character vectors.
Error in aconv (line 31)
fflip = reverse(f);
Error in DownDyadLo (line 14)
d = aconv(qmf,x);
Error in FWT_PO (line 26)
beta = DownDyadLo(beta,qmf) ;
%------------------------------------------------------------
How can I get this matrix?
The matrix should be W*W (W is 256), suppose its name is Psi;
X is a matrix (N*W);
Teta is the coefficients matrix and is (W*N).
------------------------------------------------------------
I want to expand X like X=Psi*Teta.
------------------------------------------------------------
There exists two more toolboxes but I have to use this one and the results of those two are not the same (They give different matrices).

Answers (1)

Kristupas Bajarunas
Kristupas Bajarunas on 23 Jun 2019
function [a,d,matrix]=daub(signal,level)
len=length(signal);
if mod(length(signal),2)
error('Singal must have even length')
end
if mod(level,2)
error('Level must have even length')
end
wMatrix=zeros(len);
zz=dbaux(level/2,sqrt(2));
zz1=zz(end:-1:1);
zz1(2:2:end)=zz1(2:2:end)*-1;
shft=level/2;
for i =1:2:len-level+2
% if
%
%
% end
wMatrix(i,i:i+level-1)=zz
wMatrix(i+1,i:i+level-1)=zz1
end
fart=len-level+3:len;
shift=2;
for j=len-level+3:2:len
wMatrix(j,end-level+1:end)=zz
wMatrix(j,:)=circshift(wMatrix(j,:),shift);
wMatrix(j+1,end-level+1:end)=zz1
wMatrix(j+1,:)=circshift(wMatrix(j+1,:),shift);
shift=shift+2
end
% wMatrix(end-1,end-1:end)=zz(1:2);
% wMatrix(end-1,1:2)=zz(3:4);
% wMatrix(end,end-1:end)=zz1(1:2);
% wMatrix(end,1:2)=zz1(3:4);
matrix=wMatrix
Vec=wMatrix*signal;
a=Vec(1:2:end-1);
d=Vec(2:2:end);
back=wMatrix'*Vec
eror=mean((back-signal).^2)
end

Community Treasure Hunt

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

Start Hunting!