作业帮 > 数学 > 作业

MATLAB求解多元二次方程极小值

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/09/14 01:54:06
MATLAB求解多元二次方程极小值
请用MATLAB帮忙求解,给出计算过程.
在满足:5≤x1≤35;350≤x2≤450;70≤x3≤90;10≤x4≤30的前提下,
求y=0.38-11.7*x1-0.5*x2-1.2*x3-0.42*x4+21.6*x1*x1-0.25*x2*x2-0.02*x3*x3-0.32*x4*x4+1.36*x1*x2+4.52*x1*x3+1.16*x1*x4+0.13*x2*x3+0.29*x2*x4+0.06*x3*x4的极小值.
一起学习下
定义函数:
function y=youhualianxi_02(x)
y=0.38-11.7*x(1)-0.5*x(2)-1.2*x(3)-0.42*x(4)+21.6*x(1)^2-0.25*x(2)^2-0.02*x(3)^2 ...
-0.32*x(4)^2 +1.36*x(1)*x(2)+4.52*x(1)*x(3)+1.16*x(1)*x(4)+0.13*x(2)*x(3)+0.29*x(2)*x(4) ...
+0.06*x(3)*x(4)
clc,clear
format long
lb=[5 350 70 10]';
ub=[35 450 90 30]';
x0=[10 400 80 20]';
[x,y]=fminimax(@youhualianxi_02,x0,[],[],[],[],lb,ub)
结果:
x =
5
450
70
10
y =
-4.044432000000000e+004
再问: 您好! 按照您的程序,我运行到最后出现 ??? Undefined function or variable "dataType". Error in ==> fminimax at 214 if ~strcmp(dataType,'double')” 请问怎么回事? 谢谢!
再答: 又运行了下,和之前一样的。上面“”定义函数“和”求解“中的代码是单独的文件,运行”求解“中的代码就得到结果。