计量工具箱

源代码在线查看: banana.m

软件大小: 7851 K
上传用户: iamguest88
关键词: 计量 工具箱
下载地址: 免注册下载 普通下载 VIP

相关代码

				function z=banana(parm,flag)				% PURPOSE: Banana function for testing optimization				% ----------------------------------------------				% USAGE: z = banana(parm,flag)				% where: parm = a 2 by 1 vector with				%               x,y input arguments				%        flag = 0 for z = 100*(y-x.^2).^2+(1-x).^2				%        flag = 1 for -z				% ----------------------------------------------				% RETURNS: z = 100*(y-x.^2).^2+(1-x).^2, if flag = 0				%          -z if flag = 1				% ----------------------------------------------								if nargin == 1				iflag = 0;				elseif nargin == 2				iflag = 1;				end;								[t1 t2] = size(parm);				if t2 == 1				x = parm(1,1);				y = parm(2,1);				else				x = parm(1,1);				y = parm(1,2);				end;								  z = 100*(y-x.^2).^2+(1-x).^2;				if iflag == 1				z = -z;				end;			

相关资源