function weierstr
% weierstr Fraktalas, pagal M.F. Barnsley, L.P. Hurd,
% fractal Image Compression, A.K. Peters Ltd., 1993

N=1024*2+1; N2=floor(N/2);
x=zeros(1,N); t=(0:N-1)/N*2*pi; c=cos(t);
q=sqrt(2)/2; i1=1:2:N; i2=N-1:-2:1; 
j1=1:N2+1; j2=N2+2:N;
for k=1:10,
 x(j1) = q*(x(i1)+c(j1));
 x(j2) = q*(x(i2)+c(j2));
end;
plot(t,-x); title('Vejerstraso funkcija');
