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

    %% Root of Function with Extra Parameter  
% Find the root of a function that has an extra parameter.   

% Copyright 2015 The MathWorks, Inc.


%%  
myfun = @(x,c) cos(c*x);  % parameterized function
c = 2;                    % parameter
fun = @(x) myfun(x,c);    % function of x alone
x = fzero(fun,0.1)