how I Found the minimum of function using the fminbnd ??

1 次查看(过去 30 天)
f(x)=3x1+2x1x2+x2 such as 0.1≤ x1 ≤1 0.25 ≤ x2 ≤ 4 help me please thanks in advance

回答(2 个)

Walter Roberson
Walter Roberson 2018-6-7
You cannot do that. fminbnd() can only be used for a function of a single variable.
  1 个评论
Walter Roberson
Walter Roberson 2018-6-7
fun = @(x) 3*x(1) + 2*x(1)*x(2) + x(2)
x0 = [.5 2.5];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0.1 0.25];
ub = [1 4];
x12 = fmincon(fun, x0, A, b, Aeq, beq, lb, ub)
x1 = x12(1); x2 = x12(2);

请先登录,再进行评论。


Torsten
Torsten 2018-6-7
You can't. fminbnd is for functions of one variable - your f is a function of two variables.
Use "fmincon" instead.
Best wishes
Torsten.
  7 个评论
Torsten
Torsten 2018-6-7
In principle, x0 is arbitrary.
But if you know an x0 that is feasible and near to the optimum, you should use it since you'll most probably get faster and more stable convergence towards the solution.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by