I have a 2 D matrix where each column is a set of data that is Weibull distributed. I want to use wblfit to get the parameters for each column of data without using for loop.

2 ビュー (過去 30 日間)
for e.g. I have X =[20,5}. Basically i have 5 data sets stacked up. Can do something like [p] = wblfit(X)... and p should contain the parameters for each column of data. p(1) = [a1,b1]; p(2)=[a(2),b(2)]; I can do this the long hand way using for loop but i would like to do it in one go without a for loop. Note: In my actual case I have a huge matrix and I would like to save cpu time by somehow using matrix operations rather than for loop operation. Hence my question. Thanks in advance for help.

採用された回答

Ahmet Cecen
Ahmet Cecen 2016 年 12 月 28 日
編集済み: Ahmet Cecen 2016 年 12 月 28 日
This should work faster than an explicit for loop:
Result = splitapply(@(x1){wblfit(x1)},X,1:size(X,2));
Then each group of parameters can be accessed as:
Result{columnindex};
  1 件のコメント
Pappu Murthy
Pappu Murthy 2016 年 12 月 28 日
thanks. that worked perfectly alright. Meanwhile I found out that i could use the cellfun to achieve the same result.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by