Matlab solution to Legendre wavelets