Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
回复
 
主题工具 显示模式
旧 2013-04-13, 16:28   #1
X1swqazx
初级会员
 
注册日期: 2013-04-13
帖子: 1
声望力: 0
X1swqazx 正向着好的方向发展
默认 初学者求助结构体和函数句柄作为自变量的问题

老师给的一个m文件
function [StepSize info perf] = ...
search(ObjFun, Point, Step, Rule, varargin)
%Find the answer to problem P: a = argmin f(x+a*d)
%
% This function will use exact or inexact line search to solve the problem.
% When doing inexact line search, you can choose Armijo-Goldstein, Wolfe,
% strong Wolfe or you own criterion.
% Record g as the gradient of f.
%
% Call
% [StepSize err] = bolinesearch(ObjFun, Point, Step)
% [StepSize err] = bolinesearch(ObjFun, Point, Step, Rule)
% [StepSize err] = bolinesearch(ObjFun, Point, Step, Rule, p1,p2,...)
% [StepSize err perf] = bolinesearch(......)
%
% Input
% ObjFun: f & g in P, function_handle
% The function should be declared as a M-function
% [F g] = f(x, p1,p2,...)
% F is a scalar, along with g an n-vector.
% Point: x in P, n-vector
% Step: d in P, n-vector
% Rule: option & method & criterion to solve P, struct
% Rule.crtr: criterion, function_handle
% The function should be declared as a M-function
% Judge = criterion(Step, StepSize, Data0, Data, flag)
% Judge is a logical number with 1 perfect, and Step is just
% as metioned above StepSize below, and Data0 & Data are
% structs including possible fields F g, flag is a array
% including several parameters in the criterion.
% choice: boarmgld, bowlf, bostwlf
% Rule.mthd: method to get new point, function_handle
% The function shoule be declared as a M-function
% [NewSize New] = method(ObjFun, Point, Step, StepSize,
% Data, p1,p2,...)
% notice here StepSize & NewSize can be a scalar array(to
% make coding easy), but only the 1st element is just needed
% actually. And in that situation the Data & New will be
% struct arrays.
% choice: bointrplt22, bointrplt33
% Rule.opt: options of iteration, scalar array
% opt(1): 0 - exact line search, use .618 method
% else - inexact, need crtr & mthd
% (2): upper bound of a
% (3): maximum of iterations
% (4:5): criterion flag, but also can be .618 method flag which
% have one element e with default 1e-3
% default: bostwlf - bointrplt33 - [1 10 10 0.95 0.05]
% or [0 10 25 1e-4] (if opt(1) = 0)
%

请问在使用函数时输入的参数格式是怎样的,又是函数句柄又是结构体我总是输不对
X1swqazx 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码



所有时间均为北京时间。现在的时间是 16:01


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.