公爵兰 发表于 2006-3-21 19:22:35

急问,matlab中关于优化的问题。急啊!

我按照书上的思路编了一个程序,可是有如下错误,不知道为什么,哪位大侠帮帮忙!<BR>首先定义了一个fmincono.m文件<BR>function f=myfun(x)<BR>f=3.12(((x(1)-3.2)^2+(x(2)-6.34)^2)^0.5+((x(1)-1.31)^2+(x(2)-4.67)^2)^0.5);<BR>然后运行<BR>x0=;<BR>&gt;&gt; lb=;<BR>&gt;&gt; ub=;<BR>&gt;&gt; x=fmincon(@fmincono,x0,[],[],[],[],lb,ub)<BR>Warning: Large-scale (trust region) method does not currently solve this type of problem,<BR>switching to medium-scale (line search).<BR>&gt; In fmincon at 260<BR>??? Error using ==&gt; fmincon<BR>FMINCON cannot continue because user supplied objective function failed with the following error:<BR>Error using ==&gt; feval<BR>Undefined command/function 'fmincono'.<BR>实在是不知道是什么问题<BR>而且我把书上的例子写进去,也出现相同的错误。 <BR><BR>

aabdyaabdy 发表于 2008-7-14 21:25:48

应该是x=fmincon(@myfun,x0,[],[],[],[],lb,ub)
页: [1]
查看完整版本: 急问,matlab中关于优化的问题。急啊!