フィルターのクリア

Optimization of multivariable function using fminunc

2 ビュー (過去 30 日間)
Sushovit Adhikari
Sushovit Adhikari 2015 年 6 月 9 日
編集済み: Walter Roberson 2015 年 6 月 11 日
Hi, I have a function of the form H = X*matrix(A) + Y*matrix(B) and matrix(A) and (B) are fixed. I need to optimize X and Y simultaneously, how can I do it?
For example: if I just had H=X*matrix(A) + matrix(B), I could have used fminunc. I could have created a function handle for H and pass it as an argument in fminunc. I know how to do it for single variable, but I just don't know how to do it in multiple variable. I looked up many resources, including many old post, but I got more confused. Any help would be appreciated. Thank You
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 10 日
are X and Y matrices or vectors? If they are matrices then H is a matrix, and in that case you need to define what it means to "optimize" H. Lowest trace? Smallest sum-of-squares?

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

回答 (1 件)

Drew Davis
Drew Davis 2015 年 6 月 10 日
Define your function handle like so:
f = @(x) x(1:a) * A + x(a+1:end) * B
where:
X = x(1:a) , Y = x(a+1:end)
then
x = fminunc(f , x0);
where:
X0 = x0(1:a) , Y0 = x0(a+1:end)
Note 'a' is the number of elements in the 'X' vector.
  4 件のコメント
Drew Davis
Drew Davis 2015 年 6 月 11 日
fminunc will take row vectors (depends on initial points as you suggested). Try the following:
fminunc(@(x) x(1)^2 + 0.1 * x(2)^2 , [1,1])
Walter Roberson
Walter Roberson 2015 年 6 月 11 日
編集済み: Walter Roberson 2015 年 6 月 11 日
Okay, but we still end up with problems with the output size. The only non-trivial case of this form that fminunc can deal with has a trivial solution of letting some of the components go to infinity or negative infinity. This then gets back to the question I posed earlier about what about the matrix is to be "minimized", such as possibly the trace.

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

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by