% % compute and plot the error between successive FE approximations % by stepping through powers of 1/10 % [t,x] = mycub_fe(0.1,20,[1 1]); for j=1:4, dt(j) = 1/10^(j+1); [newt,newx] = mycub_fe(dt(j),20,[1 1]); xdiff = abs( newx(1:10:end,:) - x ); err(j) = max( max( xdiff ) ); x = newx; end loglog(10*dt,err,'x-') xlabel('coarse dt','fontsize',16) ylabel('max difference in FE solutions','fontsize',16)