function [a, b, k] = min_bisection(fun_expression, alpha, beta, epsilon, lambda) % % Detailed explanation goes here % % % Error checking if 2*epsilon >= lambda || lambda <= 0 error ('Convergence criteria not met') end % Init a = alpha; b = beta; fun = matlabFunction(fun_expression); k=1; while b(k) - a(k) > lambda % bisect [a,b] mid = (a(k) + b(k)) / 2; x_1 = mid - epsilon; x_2 = mid + epsilon; % set new search interval k = k + 1; if fun(x_1) < fun(x_2) a(k) = a(k-1); b(k) = x_2; else a(k) = x_1; b(k) = b(k-1); end end