pirate99 发表于 2007-3-5 15:55

优化问题

funf='f=0.0061*[(x(1)^2-x(5)^2)*x(4)+(x(2)^2-x(5)^2)*x(3)];';
fung='g=;';
fun=;
x0=[-1 1];
options=[];
=constr(fun, x0, options);


Warning: The function CONSTR is obsolete and has been replaced by
FMINCON.CONSTR will be removed in a future release of the
Optimization Toolbox.Update your code to call FMINCON to
suppress this warning message.See "Converting your code to
Version 2 Syntax" in the Optimization Toolbox User's Guide
for more information.

> In F:\Matlab\toolbox\optim\constr.m at line 55
??? Error using ==> inlineeval
Error in inline expression ==> 0.0061*[(x(1)^2-x(5)^2)*x(4)+(x(2)^2-x(5)^2)*x(3)]
???Index exceeds matrix dimensions.

Error in ==> F:\Matlab\toolbox\matlab\funfun\@inline\feval.m
On line 34==>         INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);

Error in ==> F:\Matlab\toolbox\optim\private\opteval.m
On line 27==>       f = feval(FUNfcns{1},x,varargin{:});

Error in ==> F:\Matlab\toolbox\optim\private\nlconstold.m
On line 59==>    = opteval(x,FUNfcn,varargin{:});

Error in ==> F:\Matlab\toolbox\optim\constr.m
On line 86==> =nlconstold(funfcn,x,OPTIONS,VLB,VUB,gradfcn,varargin{:});


惩罚函数法计算最优解,怎么调,高手指教!

[ 本帖最后由 xinyuxf 于 2007-7-22 12:15 编辑 ]

happy 发表于 2007-3-12 01:35

改用FMINCON来做,具体参考帮助
页: [1]
查看完整版本: 优化问题