フィルターのクリア

How to fit a function with two or more dependant variables (outputs)?

6 ビュー (過去 30 日間)
Ryan Bisbey
Ryan Bisbey 2022 年 6 月 2 日
回答済み: M Mirrashid 2022 年 6 月 5 日
I have a complex matlab function that takes x -> (y1,y2) based on several passed parameters. I would like to use curve fitting to find the optimal parameters that fit the function to data. Are there any such tools in MATLAB to accomplish this? nlinfit and the others seem to only want to work with a single independant variable column vector and a single dependant variable column vector (i.e. x -> y).
  3 件のコメント
Ryan Bisbey
Ryan Bisbey 2022 年 6 月 2 日
Thanks for the prompt response @Torsten. With nlinfit when the dependant input is an array not a vector you get the error:
Requires a vector second input argument.
Which results from:
elseif ~isvector(y)
error(message('stats:nlinfit:NonVectorY'));
end
in the nlinfit code. Were you suggesting I use another curve fitting function than nlinfit?
Torsten
Torsten 2022 年 6 月 2 日
編集済み: Torsten 2022 年 6 月 2 日
What is the difference between an array and a vector ?
If you enter X and Y as independent and dependent vectors, all should work out fine.

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

採用された回答

Matt J
Matt J 2022 年 6 月 2 日
lsqcurvefit does not care about the dimensionality of the independent or dependant variables.
  3 件のコメント
Ryan Bisbey
Ryan Bisbey 2022 年 6 月 2 日
編集済み: Ryan Bisbey 2022 年 6 月 2 日
@Star Strider, your message was helpful too to confirm that the dimensionality of nlinfit output must be a vector not a matrix. (I think the message is deleted now.) Thanks!
Star Strider
Star Strider 2022 年 6 月 2 日
My pleasure.
I almost always delete my un-accepted answers.

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

その他の回答 (1 件)

M Mirrashid
M Mirrashid 2022 年 6 月 5 日

カテゴリ

Help Center および File ExchangeSurrogate Optimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by