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

    %% Solve Problem Structure  
% Solve a problem that is defined by a problem structure.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define a structure that encodes a root-finding problem. 
problem.objective = @(x)sin(cosh(x));
problem.x0 = 1;
problem.solver = 'fzero'; % a required part of the structure
problem.options = optimset(@fzero); % default options  

%% 
% Solve the problem. 
x = fzero(problem)