% using fzero % Simplest example specifying initial guess f = @(x) x - exp(-x); fzero(f, 0.6) % Example using a sign-changing interval f = @(x) x - exp(-x); fzero(f, [0.5,0.6]) % Changing the tolerance options = optimset('TolX', 1e-10); fzero(f,1,options) % Example which displays information on iterations opt = optimset('Display','iter'); f = @(x) x - exp(-x); fzero(f, 0.6, opt); % Example with a parameter c = 2 f = @(x) c*x - exp(-x); fzero(f, 0.6) % Another way to do it f = @(x,c) c*x - exp(-x); fzero( @(x) f(x,2), 0.6)