怎么用matlab求二元函数的最大值
f=5+1350*(1-x)^(2.9)+1350*x^3*((1-y)^(2.9)-(1-x)^(2.9))+135*y^3*(1-10*(1-y^(2.9)));其中...
f=5+1350*(1-x)^(2.9)+1350*x^3*((1-y)^(2.9)-(1-x)^(2.9))+135*y^3*(1-10*(1-y^(2.9)));其中0.8<x<1,0.6<y<0.8
展开
1个回答
展开全部
f = @(x) -5-1350*(1-x(1))^(2.9)-1350*x(1)^3*((1-x(2))^(2.9)-(1-x(1))^(2.9))-135*x(2)^3*(1-10*(1-x(2)^(2.9)))
lb = [0.8; 0.6]; % x y的下限
ub = [1; 0.8] ; % x y的上限
x0 = [0.5;0.6]; % Starting guess at the solution
[x1,fval1] = fmincon(f,x0,[],[],[],[],lb,ub);
xmax2 = x1(1) % 极值点x的值
ymax2 = x1(2) % 极值点y的值
zmax2 = -fval1 % Z的最大值
计算结果:
xmax2 = 1
ymax2 = 0.6
zmax2 = -96.4625
lb = [0.8; 0.6]; % x y的下限
ub = [1; 0.8] ; % x y的上限
x0 = [0.5;0.6]; % Starting guess at the solution
[x1,fval1] = fmincon(f,x0,[],[],[],[],lb,ub);
xmax2 = x1(1) % 极值点x的值
ymax2 = x1(2) % 极值点y的值
zmax2 = -fval1 % Z的最大值
计算结果:
xmax2 = 1
ymax2 = 0.6
zmax2 = -96.4625
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询