Thursday, April 30, 2015

Haar Wavelet example

%uses haar functions to project functions in L2(R) into V0
k = 5;
t = -k:0.001:k;
a = 1;  %j-1 in Vj so that it is phi(t-k)
l = 1;
v = zeros(1, length(t));
y = exp(-abs(t));

for i = 1000:1000:5000
    kp = ((i/1000)-6);
    v(i-999:i) = exp(kp)*(exp(1)-1);
end
   
for i = 5001:1000:9001
    kp = (((i-1)/1000)-5);
    v(i:i+999) = exp(-(1+kp))*(exp(1)-1);
end

plot(t, y)
hold on
plot(t, v)
hold off

No comments:

Post a Comment