MATLAB: Not enough input arguments.

bisection

Hi, I am trying to run this function but it gives me this error, the function is:
function result = intentobiseccion(f, xl, xu, Ead)
iter = 0;
n=log2((xu-xl)/Ead);
while (iter < n)
xr = (xl + xu)/2; % Bisection Method
iter = iter + 1;
if (f(xl)*f(xr) < 0)
xu = xr;
else
xl = xr;
end
end
Y=round(xr);
result = xr;
and what I write in Command window is: intentobiseccion((668/x*(1-exp(-0.146843*x)-40)),12,16,0.0001)

Best Answer

Call the function as below:
f = @(x)((668/x*(1-exp(-0.146843*x)-40))) ;
intentobiseccion(f,12,16,0.0001)