% % test of simple vcycle code % global sigma sigma=10; lmax=10; itmax=5; convhist=zeros(itmax,lmax-4); convhist2=zeros(itmax,lmax-4); for l=5:lmax nl=2^l; nt=nl+1; x=0:nl; x=x'/nl; ue=exp(x).*sin(pi*x); fe=-2*pi*exp(x).*cos(pi*x)+(pi^2 + sigma -1)*ue; f=fe; v=zeros(nt,1); v2=v; u=helmholtz(fe); for it = 1:itmax vt=vcycle1(v,f,1,1); convhist(it,l-4)=norm(vt-u,inf)/norm(v-u,inf); v=vt; vt2=vcycle2(v2,f,1,1); convhist2(it,l-4)=norm(vt2-u,inf)/norm(v2-u,inf); v2=vt2; end end convhist