in this codes, how do I get the resalts as a nice table showing step by step iterations clarifying more collums would be
itteration, lower, upper, f(lower), f(upper), f(xc), f(c), xupper-xlower
function y = f(x) y = x.^3 – 2;
exists. Then:>> format long>> eps_abs = 1e-5;>> eps_step = 1e-5;>> a = 0.0;>> b = 2.0;>> while (b - a >= eps_step || ( abs( f(a) ) >= eps_abs && abs( f(b) ) >= eps_abs ) ) c = (a + b)/2; if ( f(c) == 0 ) break; elseif ( f(a)*f(c) < 0 ) b = c; else a = c; endend>> [a b]ans = 1.259918212890625 1.259925842285156>> abs(f(a))ans = 0.0000135103601622>> abs(f(b))ans = 0.0000228224229404
Best Answer