1
$\begingroup$

I am working on wavelet decomposition.As read by the theory i have implemented wavelet decomposition in MATLAB. CA and CD for wavelet decomposition of db1 matches with the inbuilt function but not with db5 CA and CD coefficients why?

My code-

f=10;
fs=200;
amp_x = 14;
amplitude for sinusodial 2
amp_y = 9;
Time vector 
t=(0:1:500);
Create a sine wave 
x = amp_x * (sin(2*pi*f/fs*t))+10*rand(1,501);

LO_D =[ 0.7071    0.7071];
HI_D =[-0.7071    0.7071];

C = conv(LO_D,x);
k = 2;
y= C(2:k:length(C));

D = conv(HI_D,x);
g=2;
y1= D(2:g:length(D));

[CA,CD] = dwt(x,'db1');

y and y1 matches with CA and CD coefficients of inbuilt function.

The same code if i change it to db5 im not getting matching results .please help me out

f=10;
fs=200;
amp_x = 14;
amplitude for sinusodial 2
amp_y = 9;
Time vector 
t=(0:1:500);
Create a sine wave 
x = amp_x * (sin(2*pi*f/fs*t))+10*rand(1,501);
%low pass and highpass filter coefficients of db5 using wfilters
LO_D =[  0.0033   -0.0126   -0.0062    0.0776   -0.0322   -0.2423    0.1384 0.7243    0.6038    0.1601];
HI_D =[ -0.1601    0.6038   -0.7243    0.1384    0.2423   -0.0322   -0.0776   -0.0062    0.0126    0.0033];

C = conv(LO_D,x);
k = 2;
y= C(2:k:length(C));

D = conv(HI_D,x);
g=2;
y1= D(2:g:length(D));

[CA,CD] = dwt(x,'db5');
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.