After running the code
xone = 2.5;
xtwo = 3.5;
root = bisection(xone,xtwo);
function root = bisection(xone,xtwo)
while abs(funcx(xthree)) > 0.0001
xthree = (xone+xtwo)/2;
if funcx(xthree) > 0
xone = xthree;
elseif funcx(xthree) < 0
xtwo = xthree;
else
end
root = xthree;
end
function fofx = funcx(x)
fofx = 3 * exp(-x) - x + 3;
end
disp(root)
I get the error
Unrecognized function or variable 'bisection'.
As far as I am aware, I have nested my function correctly. Any ideas?