Can I use fitnlm inside the splitapply command?

1 回表示 (過去 30 日間)
Francisco GarcesVega
Francisco GarcesVega 2016 年 7 月 25 日
回答済み: Div Tiwari 2016 年 8 月 8 日
Can I use fitnlm inside the splitapply command?, if so can you provide the right syntaxis or command line. I had try several and keep getting error in the line. I have use this form, or the same form setting the anonymous funcction before the splitapply line but get the same error.
yw=splitapply(@fitnlm,DataD.time,DataD.logNN0,@(b,x)-(x/b(1)).^b(2),[2 .7],G)
The data variables must have the same number of rows as the vector of group numbers. The group number vector has 259 row(s), and data variable 3 has 1 row(s).
Thanks

回答 (1 件)

Div Tiwari
Div Tiwari 2016 年 8 月 8 日
The 'splitapply' function requires all data input arguments to have the same length as G if the data is a vector, or have their number of rows or columns equal the length of G, depending on the orientation of G. Please use 'repmat' for the function handle and coefficients of the model in order to meet this requirement.
Additionally, if the 'func' input to 'splitapply' returns a nonscalar output argument, the argument must be oriented so that splitapply can concatenate the output arguments from successive calls to 'func'. Since 'fitnlm' returns a NonLinearModel object, you may define an anonymous function to call fitnlm, and then return the estimate from the resulting fitted model object. You can then use its handle as the first input argument to 'splitapply'.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by