www.gusucode.com > optim 案例源码 matlab代码程序 > optim/RootStartingFromanIntervalExample.m

    %% Root Starting From an Interval  
% Find the zero of cosine between |1| and |2|.   

% Copyright 2015 The MathWorks, Inc.


%%  
fun = @cos; % function
x0 = [1 2]; % initial interval
x = fzero(fun,x0) 

%%
% Note that |cos(1)| and |cos(2)| differ in sign.