- #1

- 17

- 0

I'm trying to reproduce daubechies basic building graph and daubechies wavelet function graph (φ(r)=0 if r≦0 or 3≦r). And i found this algorithm. I would appreciate if there is anybody could help me to understand the function defined below as function [s,w] = cascade(n,cs,cw). Especially how does the convolution takes place. Thank you in advance.

>%Filter coefficients for daub4 (h<->scaling, g<->wavelet)

>h = [1+sqrt(3) 3+sqrt(3) 3-sqrt(3) 1-sqrt(3)]/(4*sqrt(2));

>g = [h(4) -h(3) h(2) -h(1)];

>

>%Calculate 5 iterations of the cascade algorithm

>[s,w]=cascade(5,h,g);

>plot(s); %Plot scaling function

>plot(w); %Plot wavelet function

-----------------------------------------------------------

>function [s,w] = cascade(n,cs,cw)

>

> s = cs;

> w = cw;

> x2(1:2:length(w)*2) = w;

> x2(2:2:end)=0;

> x(1:2:length(s)*2) = s;

> x(2:2:end)=0;

>

> for i = 1:n

>

> s = conv(x,cs);

> w = conv(x2,cs);

>

> x2(1:2:length(w)*2) = w;

> x2(2:2:end)=0;

> x(1:2:length(s)*2) = s;

> x(2:2:end)=0;

>

> end

>

>end