24小时热门版块排行榜    

查看: 2879  |  回复: 11
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

492990274

铁杆木虫 (正式写手)

[求助] matlab求三元二次函数最大值

急求用matlab求三元二次函数最大值的编程语句!
急!
函数如:
y=100+30A+78B+90C-1.4A^2+7.2B^2-9.53C^2+0.84AB+0.48BC-9.39BC
请将具体命令写出,谢谢,谢谢~
回复此楼
渴望改变~
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★
492990274: 金币+5, ★★★★★最佳答案 2012-11-28 20:14:38
可以使用X = fmincon(FUN,X0,A,B,Aeq,Beq,LB,UB)

y=@(x)-(100+30*x(1)+78*x(2)+90*x(3)-1.4*x(1).^2+7.2*x(2).^2-9.53*x(3).^2+...
0.84*x(1)*x(2)+0.48*x(1)*x(3)-9.39*x(2)*x(3));
X0=;%ABC计算初值
LB=;%ABC下限
UB=;%ABC上限

X = fmincon(@(x)y(x),X0,[],[],[],B[],LB,UB)
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
10楼2012-11-27 20:53:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 12 个回答

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
不给定ABC的取值范围,这个函数的最大值可能是无穷大啊
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2012-11-27 09:17:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
492990274: 金币+10, ★★★★★最佳答案, 非常感谢~ 2012-11-27 19:53:05
xzhdty: 金币+2, 谢谢参与 2012-11-27 20:53:49
>> y=@(x)100+30*x(1)+78*x(2)+90*x(3)-1.4*x(1).^2+7.2*x(2).^2-9.53*x(3).^2+...
0.84*x(1)*x(2)+0.48*x(1)*x(3)-9.39*x(2)*x(3);
X = fminsearch(@(x) y(x),[0.3 1 1])

Exiting: Maximum number of function evaluations has been exceeded
         - increase MaxFunEvals option.
         Current function value: -48992246282801925000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000


X =

  1.0e+051 *

    0.1933   -1.2573   -1.9638
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
3楼2012-11-27 09:31:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

引用回帖:
3楼: Originally posted by dbb627 at 2012-11-27 09:31:30
>> y=@(x)100+30*x(1)+78*x(2)+90*x(3)-1.4*x(1).^2+7.2*x(2).^2-9.53*x(3).^2+...
0.84*x(1)*x(2)+0.48*x(1)*x(3)-9.39*x(2)*x(3);
X = fminsearch(@(x) y(x),)

Exiting: Maximum number of function ...

这个写的有点问题,求最大值,将y前面乘个负号
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2012-11-27 09:33:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见