>> for i=1:10, err(i) = exp(2) - dd_mid(2,1/2^i); end >> format short e >> err the errors are decreasing... err = Columns 1 through 6 -1.5523e-001 -3.8565e-002 -9.6262e-003 -2.4056e-003 -6.0134e-004 -1.5033e-004 Columns 7 through 10 -3.7583e-005 -9.3957e-006 -2.3490e-006 -5.8645e-007 >> for i=1:9, ratio(i) = err(i)/err(i+1); end >> ratio The ratio is going to 4, as expected, but it's being a little odd by the end... ratio = Columns 1 through 6 4.0251e+000 4.0063e+000 4.0016e+000 4.0004e+000 4.0001e+000 4.0000e+000 Columns 7 through 9 4.0000e+000 3.9999e+000 4.0054e+000 >> for i=1:20, h(i) = 1/2^i; err(i) = exp(2) - dd_mid(2,1/2^i); end The error is increasing! >> err err = Columns 1 through 6 -1.5523e-001 -3.8565e-002 -9.6262e-003 -2.4056e-003 -6.0134e-004 -1.5033e-004 Columns 7 through 12 -3.7583e-005 -9.3957e-006 -2.3490e-006 -5.8645e-007 -1.4407e-007 -3.2313e-008 Columns 13 through 18 1.2390e-008 1.3160e-007 8.4686e-007 2.7542e-006 1.8013e-005 1.8013e-005 Columns 19 through 20 1.4008e-004 3.8422e-004 let's take h even smaller and see how large we can get the error >> for i=1:30, h(i) = 1/2^i; err(i) = exp(2) - dd_mid(2,1/2^i); end >> h h = Columns 1 through 6 5.0000e-001 2.5000e-001 1.2500e-001 6.2500e-002 3.1250e-002 1.5625e-002 Columns 7 through 12 7.8125e-003 3.9063e-003 1.9531e-003 9.7656e-004 4.8828e-004 2.4414e-004 Columns 13 through 18 1.2207e-004 6.1035e-005 3.0518e-005 1.5259e-005 7.6294e-006 3.8147e-006 Columns 19 through 24 1.9073e-006 9.5367e-007 4.7684e-007 2.3842e-007 1.1921e-007 5.9605e-008 Columns 25 through 30 2.9802e-008 1.4901e-008 7.4506e-009 3.7253e-009 1.8626e-009 9.3132e-010 Now the error is huge, even though h hasn't reached anywhere near the round-off level. >> err err = Columns 1 through 6 -1.5523e-001 -3.8565e-002 -9.6262e-003 -2.4056e-003 -6.0134e-004 -1.5033e-004 Columns 7 through 12 -3.7583e-005 -9.3957e-006 -2.3490e-006 -5.8645e-007 -1.4407e-007 -3.2313e-008 Columns 13 through 18 1.2390e-008 1.3160e-007 8.4686e-007 2.7542e-006 1.8013e-005 1.8013e-005 Columns 19 through 24 1.4008e-004 3.8422e-004 2.3373e-003 -1.5689e-003 1.4056e-002 1.3906e-001 Columns 25 through 30 3.8906e-001 3.3891e+000 7.3891e+000 7.1389e+001 7.3891e+000 7.3891e+000 diary off;