作业帮 > 英语 > 作业

matlab中求解二元函数的极小值,20分.

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/21 14:15:18
matlab中求解二元函数的极小值,20分.
x0=[22,38];x1=[8,13];x2=[5,81];x3=[52,32];x4=[38,11];x5=[16,12];x6=[81,63];x7=[18,45];x8=[62,12];
A=[17,40,60,25,30,15,50,8,35];
w=A*[sqrt((x-x0)*(x-x0)`);sqrt((x-x1)*(x-x1)`);sqrt((x-x2)*(x-x2)`);sqrt((x-x3)*(x-x3)`);sqrt((x-x4)*(x-x4)`);sqrt((x-x5)*(x-x5)`);sqrt((x-x6)*(x-x6)`);sqrt((x-x7)*(x-x7)`);sqrt((x-x8)*(x-x8)`)];上面为函数.
x0=[22,38];x1=[8,13];x2=[5,81];x3=[52,32];x4=[38,11];x5=[16,12];x6=[81,63];x7=[18,45];x8=[62,12];h=fmins(`s`,x0)
这个有什么问题啊?我把函数保存了,然后用下面的进行运行,但是错误,是为什么啊?出现错误的提示是x0=[22,38];x1=[8,13];x2=[5,81];x3=[52,32];x4=[38,11];x5=[16,12];x6=[81,63];x7=[18,45];x8=[62,12];h=fmins('s',x0)
Warning: FMINS is obsolete and has been replaced by FMINSEARCH.
FMINS now calls FMINSEARCH which uses the following syntax:
[X,FVAL,EXITFLAG,OUTPUT] = FMINSEARCH(FUN,X0,OPTIONS,P1,P2,...)
Use OPTIMSET to define optimization options, or type
'edit fmins' to view the code used here. FMINS will be
removed in the future; please use FMINSEARCH with the new syntax.
(Type "warning off MATLAB:fmins:ObsoleteFunction" to suppress this warning.)
> In D:\Matlab\toolbox\matlab\funfun\fmins.m at line 58
? Error: File: D:\Matlab\bin\win32\s.m Line: 4 Column: 24
Missing variable or function.
Error in ==> D:\Matlab\toolbox\matlab\funfun\fminsearch.m
On line 125 ==> fv(:,1) = feval(funfcn,x,varargin{:});
Error in ==> D:\Matlab\toolbox\matlab\funfun\fmins.m
On line 73 ==> [x,FVAL,EXITFLAG,OUTPUT] = fminsearch(funfcn,x,Options,varargin{:});
求高手解答啊,希望可以给我吧这个函数写出来.谢谢了.在线等待...
把你的函数用数学用数学式子写出来,还有是fmins在高版本的Matlab中不在使用,换成了fminsearch