function c=haar(y,n) ly=length(y)-1; x=[0:1/ly:1]; for i=0:n for j=0:2^i-1 c(i+1,j+1)=2^(i)*trapz(x,y.*mf(2^(i).*x-j)); endfor; endfor; endfunction