Does lsqnonlin handle a matrix objective function?

17 ビュー (過去 30 日間)
Nat A
Nat A 2024 年 3 月 17 日
コメント済み: Matt J 2024 年 3 月 17 日
How does lsqnonlin handle a matrix?
assuming something like
[Final_Ests,resNormal] = lsqnonlin(LSQ_obj_fnctn,initialGuess,LB,UB);
will the results be the same if LSQ_obj_fnctn is a matrix vs being a single vector made up of matrix rows?
i.e. matrix:
LSQ_obj_fnctn = rand(4,10)
vs. vector made up of matrix rows
LSQ_obj_fnctn = rand(1,40)
To be clear, I'm not actually trying to minimize a randomly generated matrix or vector, just trying to show an example of the form of what I'm passing to lsqnonlin. My results seem to indicate both matrix and vector objective functions give the same result, but I just want to be triple sure I'm not misunderstanding something.
Thanks!

採用された回答

Matt J
Matt J 2024 年 3 月 17 日
編集済み: Matt J 2024 年 3 月 17 日
The matrix dimensions of the objective function output can be whatever you wish. It doesn't affect anything. The initialGuess can also be array-valued, although there are bugs in that feature in older versions.
Note that a closely related function lsqcurvefit,
can also have matrix-valued fun, but the ydata argument must have the same matrix dimension.
  2 件のコメント
Nat A
Nat A 2024 年 3 月 17 日
Thank you!
Matt J
Matt J 2024 年 3 月 17 日
Your welcome, but if this answers your question, please Accept-click the answer.

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

その他の回答 (0 件)

カテゴリ

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