How to use cellfun?

5 ビュー (過去 30 日間)
Paolo Ottonelli
Paolo Ottonelli 2020 年 1 月 9 日
コメント済み: Paolo Ottonelli 2020 年 1 月 9 日
Hello, I have 2 cell arrays (XM and YM), both of them have 3 separated cells. The first array has x values of a certain function while the second has the respective y. I have to perform a non linear regression using the last squares so I created the interpolant function and a objective function to be minimized. Is possible obtain a 3x1 cell where i can find the output patameters without divide the initial arrays using A = cellfun(func,C)?
The following code shows how i have done; it works but I wouldn't like to separate the original arrays'cells
YM=3x1cell
XM=3x1cell
[c1,val1] = fminbnd(@(c0)objfunc(YM1{1},deg(c0,XM{1},'other input parameters')),cm,cM); %deg is my interpolant function, objfunc is my objective function
[c2,val2] = fminbnd(@(c0)objfunc(YM1{2},deg(c0,XM{2},'other input parameters')),cm,cM);
[c3,val3] = fminbnd(@(c0)objfunc(YM1{3},deg(c0,XM{3},'other input parameters')),cm,cM);

採用された回答

Stephen23
Stephen23 2020 年 1 月 9 日
fun = @(x,y) fminbnd(@(c0)objfunc(y,deg(c0,x,'other input parameters')),cm,cM);
[C,V] = cellfun(fun,XM,YM,'Uni',0)
  1 件のコメント
Paolo Ottonelli
Paolo Ottonelli 2020 年 1 月 9 日
Thank you so much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by