function [W0,t]=waveletbm(maxj)
%generates brownian motion using a wavelet series: see Steele
t=(0:2^(maxj+1))/2^(maxj+1);
j=0
w=randn*2*t; W0=w;
for j=1:maxj
    z=normrnd(0,1/2^(1+j/2),1,2^j);
    for k=1:2^j
        w=w+z(k)*delta(t,j,k-1);
    end
   W0=[W0;w]; 
end