Because it eliminates the leading order contribution to the error which leads

# Because it eliminates the leading order contribution

• Homework Help
• 6
• 100% (11) 11 out of 11 people found this document helpful

This preview shows page 4 - 6 out of 6 pages.

Because it eliminates the leading order contribution to the error, which leads to order 2 of convergence. 5. %(a) For N even, T 2/N =1 clear; clc; for i=1:20 N(i)=2*i+1; h1(i)=2/N(i); z(i)=Int(h1(i),-1,1,inline( 'abs(x)' )); e1(i)=abs(z(i)-1); % error for different step size end figure(1) plot(h1,e1); xlabel ( 'step size' ); ylabel ( 'error' );
Norbert Shao 1/25/17 Tuesday 10am disp( 'the order of convergence is 2' ) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0 0.02 0.04 0.06 0.08 0.1 0.12 step size error Based on plot, the order of convergence is 2 for odd values of N. %(b) for i=1:4 h2(i)=1/(16*2^i); z(i)=Int(h2(i),0,1,inline( 'x.^0.5' )); e2(i)=abs(z(i)-(2/3)); % error for different step size end figure(2) plot(h2,e2); xlabel ( 'step size' ); ylabel ( 'error' );
Norbert Shao 1/25/17 Tuesday 10am 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0 0.2 0.4 0.6 0.8 1 1.2 x 10 -3 step size e rro r There is a second order convergence to the exact value of the Integral because the plot shows a quadratic trend.