早教吧作业答案频道 -->英语-->
还是昨天那个问题,用matlab优化一个方程,d=x-(x*x-40-6*a*x)^(0.5),多一个条件,x在10到20之间,a在0到1之间,求d取最小值,同时a尽可能的接近1.如果要加权的话,就随便设一个,要过程,麻烦您了请问
题目详情
还是昨天那个问题,用matlab优化一个方程, d=x-(x*x-40-6*a*x)^(0.5) ,多一个条件, x在10到20之间, a在0到1之间,求d取最小值,同时a尽可能的接近1 . 如果要加权的话,就随便设一个, 要过程,麻烦您了
请问怎么加权重呢,比如a的权取0.2 ,d取0.8
请问怎么加权重呢,比如a的权取0.2 ,d取0.8
▼优质解答
答案和解析
[x,feval,flag]= fmincon(@(x)x(1)-(x(1)*x(1)-40-6*x(2)*x(1))^(0.5),[11;0.9],[],[],[],[],[10 0],[20 1])
Warning: Trust-region-reflective method does not currently solve this type of problem,
using active-set (line search) instead.
> In fmincon at 439
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
2 1
x =
20
0
feval =
1.0263
flag =
1
d取最小值,同时a尽可能的接近1,这有个权重,d取最小值,a=0,a尽可能的接近1,d就不是最小值
你可以看下三维图,用下面的语句画图
ezsurf('x-(x.*x-40-6*y*x)^(0.5)',[10 20 0 1])
Warning: Trust-region-reflective method does not currently solve this type of problem,
using active-set (line search) instead.
> In fmincon at 439
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
2 1
x =
20
0
feval =
1.0263
flag =
1
d取最小值,同时a尽可能的接近1,这有个权重,d取最小值,a=0,a尽可能的接近1,d就不是最小值
你可以看下三维图,用下面的语句画图
ezsurf('x-(x.*x-40-6*y*x)^(0.5)',[10 20 0 1])
看了 还是昨天那个问题,用matl...的网友还看了以下:
有三包口香糖的重量和两个果冻的重量相等,现在1包口香糖加1个果冻等于100克,求没包口香糖的质量是 2020-04-09 …
数学问题考试中求解答甲箱中有2个苹果,3个雪梨,2个柑子;乙箱中有3个苹果,4个雪梨,1个柑子;现 2020-05-17 …
盘子里有8个桃,分给8个小朋友,每人正好分1个,果盘里还剩1个,这是怎么回事? 2020-06-03 …
有一颗神奇的树上长了58个果子,第一天会有1个果子从树上掉落.从第二天起,每天掉落的果子数量比前一 2020-07-17 …
我想实现这样一个效果:在EXCEL中,A1格中随机产生一个数字是1到10,B1格中有5个数在EXCE 2020-10-31 …
一口袋里有5颗糖,1个哈密瓜味,1个桃味,1个苹果味,2个牛奶味,随便抓出2个糖,如果其中一个是牛奶 2020-11-04 …
有10个箱子.每个箱子放的都是9个青苹果1个红苹果.我蒙住眼睛.每个箱子随手拿一个苹果.能拿到红苹果 2020-11-08 …
关于高中的一个概率问题为什么简单随机抽样每次抽的概率相等?在简单随机抽样中,如果总体容量为10,10 2020-11-08 …
有一颗神奇的树上长了60个果子,第一天会有1个果子掉落,从第二天起,每天掉落的果子数量比前一天多1个 2020-11-25 …
1.如果在所有正整数中随机挑选一个数,那么这个数能被7整除的概率是?2.如果在所有个位是1的正整数中 2021-01-01 …