construct wavelet function and its scaling function

2 views (last 30 days)
i am using the dilation equation to construct wavelet function and its scaling function. The process is simple, use Haar scaling and then do iteration. I successfully construct the scaling function. using the exact method and with different order of coefficients, i couldn't get the desire wavelet function.
%%
cons = [1+sqrt(3), 3+sqrt(3), 3-sqrt(3), 1-sqrt(3)]/4;
iters = 4;
f = ones(1,50);
points = 100;
length_f = 50;
for iter = 0:iters
step_size = points*2^(iter-1);
temp_t = 0:1/((2^iter)*points):4;
temp_f = zeros(size(temp_t));
for l = 0:3
temp_f(l*step_size+1:length_f+l*step_size) = cons(l+1)*f(1:length_f) + temp_f(l*step_size+1:length_f+l*step_size);
end
f = temp_f;
length_f = find(f==0, 1)-1;
plot(temp_t, f)
title("Daubechies 2 Scaling Function: iter", iter+1)
xlabel("t")
ylabel("\phi(t)")
pause(1)
end
%%
cons = [sqrt(3)-1, 3-sqrt(3), -3-sqrt(3), 1+sqrt(3)]/4;
iters = 5;
f = ones(1,50);
points = 100;
length_f = 50;
for iter = 0:iters
step_size = points*2^(iter-1);
temp_t = 0:1/((2^iter)*points):4;
temp_f = zeros(size(temp_t));
for l = 0:3
temp_f(l*step_size+1:length_f+l*step_size) = cons(l+1)*f(1:length_f) + temp_f(l*step_size+1:length_f+l*step_size);
end
f = temp_f;
length_f = find(f==0, 1)-1;
plot(temp_t, f)
title("Daubechies 2 Wavelet Function: iter", iter+1)
xlabel("t")
ylabel("\phi(t)")
pause(1)
end

Accepted Answer

konoha
konoha on 17 Aug 2021
cons_c = [1+sqrt(3), 3+sqrt(3), 3-sqrt(3), 1-sqrt(3)]/4;
cons_w = [-(sqrt(3)-1), 3-sqrt(3), -(3+sqrt(3)), 1+sqrt(3)]/4;
iters = 4;
f = ones(1,50);
points = 100;
length_f = 50;
for iter = 0:iters
step_size = points*2^(iter-1);
temp_t = 0:1/((2^iter)*points):4;
temp_cf = zeros(size(temp_t));
temp_wf = zeros(size(temp_t));
for l = 0:3
temp_cf(l*step_size+1:length_f+l*step_size) = cons_c(l+1)*f(1:length_f) +...
temp_cf(l*step_size+1:length_f+l*step_size);
end
f = temp_cf;
for l2 = 0:3
temp_wf(l2*step_size+1:length_f+l2*step_size) = cons_w(l2+1)*f(1:length_f) +...
temp_wf(l2*step_size+1:length_f+l2*step_size);
end
length_f = find(f==0, 1)-1;
subplot(2, 1, 1)
plot(temp_t, f)
title("Daubechies 2 Scaling Function: iter", iter+1)
xlabel("t")
ylabel("\phi(t)")
subplot(2, 1, 2)
plot(temp_t, temp_wf)
title("Daubechies 2 Wavelet Function: iter", iter+1)
xlabel("t")
ylabel("\psi(t)")
pause(1)
end

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!