How to repeat a function several times?

Hello everyone,
I have a function that calculates the time series of a growth rate assuming that the growth rate follows an AR(1) process. So the value t1 depends on t0 and so on. I do this procedure for different sample sizes. How can I repeat this function, say 1000 times, in the way, that the calculation begins from t0 for each simulation path and that the output is a ((1000*samplesize),x) matrix.
Thank you in advance.

 採用された回答

dpb
dpb 2017 年 10 月 15 日

0 投票

Just preallocate the output array and call the function in a loop saving each simulation in row/column of the array depending on which orientation you wish.
Alternatively, could use arrayfun but the loop will probably out-perform it....

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

Leo
2017 年 10 月 14 日

回答済み:

dpb
2017 年 10 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by