フィルターのクリア

Passing extra arguments to `nlinfit` function

6 ビュー (過去 30 日間)
Pankaj
Pankaj 2018 年 7 月 19 日
編集済み: Pankaj 2020 年 8 月 1 日
I am in interested in passing extra arguments to nlinfit function in Matlab
beta = nlinfit(X,Y,modelfun,beta0)
and let the modelfun is
function y = modelfun(beta, c, X)
y = beta(1)*x.^(beta2) + c;
My interest is to estimate beta and also to provide c externally. X and Y have their obvious meanings.
Can it be done?

採用された回答

Star Strider
Star Strider 2018 年 7 月 19 日
Your function must have your parameter vector as the first argument, your independent variable as the second argument, and any added parameters after that.
Try this:
Beta = nlinfit(X,Y,@(beta,X)modelfun(beta, c, X),beta0)
See the documentation on Passing Extra Parameters (link).
  2 件のコメント
Pankaj
Pankaj 2018 年 7 月 20 日
thanks
Star Strider
Star Strider 2018 年 7 月 20 日
As always, my pleasure.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by