Write out what prints to matlab at each step performing the
Write out what prints to matlab at each step performing the false position method in Matlab with the code located below. Assume that func=sin(x)-x^2 and xl=0.5 and xu=1. iter=0 xx=xl while(0) xo=xx fl=func(xl, varargin{:}) fu=func(xu, varargin{:}) xx=xu-fu*(xl-xu)/(fl-fu) iter=iter+1 if xx~=0,ea=abs((xx-xo))/xx*100;end test=fl*func(xx, varargin{:}) if test0 xl=xx else ea=0 end
Solution
Output of MATLAB at each step is as below:
iter =0
xx = 0.5
xo = 0.5
fl = 0.2294
fu = -0.1585
xx = 0.7957
iter = 1
test = -0.4692
xu = 0.7957
