% Program used to test wavesolve.m % My solution program is called mywavesolve.m % DPO 05/2005 global myf myf = 1; c = 1.2; tmax = 2; nx = 5; nt = 7; u0 = rand(nx-1,1); ut0 = rand(nx-1,1); [u,M,flag]=wavesolve(c,tmax,nt,nx,u0,ut0,@f); [myu,myM,myflag]=mywavesolve(c,tmax,nt,nx,u0,ut0,@f); % flag should be zero. flag % These two arrays should match. u(:,1:5) myu(:,1:5) err = norm(u-myu,'fro') % should be close to zero movie(M) nt = 5; [ux,Mx,flag]=wavesolve(c,tmax,nt,nx,u0,ut0,@f); % flag should be nonzero. flag