finding a vector that minimises a a sum of series

1 回表示 (過去 30 日間)
Eva12345
Eva12345 2021 年 2 月 8 日
回答済み: Preyas Sharma 2022 年 1 月 25 日
Hi! I'm new and do not have a lot of knowledge regardering Matlab.
I would like to find a vector that minimises function , where A is matrix and is given; A = [1 2 3 2; 1 0 2 0; 2 3 0.5 4].
Thanks for your answer! :)
Eva
  4 件のコメント
Matt J
Matt J 2021 年 2 月 9 日
編集済み: Matt J 2021 年 2 月 9 日
The sum you have written is over the first 3 columns of A. Why is the 4th column of A unused?
Eva12345
Eva12345 2021 年 2 月 9 日
編集済み: Eva12345 2021 年 2 月 9 日
The 4th column of A is unused because I gave a matrix A just for example, so I would like to solve this optimization problem in general, the only important thing is that matrix A has 3 or more columns.
Do you maybe know how to write code for the problem described above? I would really appreciate your answer.
Eva

サインインしてコメントする。

回答 (1 件)

Preyas Sharma
Preyas Sharma 2022 年 1 月 25 日
Hi Eva,
As per my understanding you need to find a vector x that can minimise your given function. In order to achieve it. you can use fmincon function
A = [1 2 3 2; 1 0 2 0; 2 3 0.5 4];
lb = [0,0,0];
ub = [1,1,1];
x0 = (lb + ub)/2;
Aeq = [1 1 1];
beq = [1];
fun = @(x)(max([x(1) x(2) x(3)]*A(:,1:3)));
[x,y] = fmincon(fun,x0,[],[],Aeq,beq,lb,ub);
Expected output:
x =
0.0489 0.5315 0.4196
y =
1.4196
here the constraint is satisfied and the function is minimised.
Hope that resolves your doubt.

カテゴリ

Help Center および File ExchangeSolver 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