フィルターのクリア

I want to run a Monte Carlo Simulation on my entire script, How do I do it.

1 回表示 (過去 30 日間)
Henn
Henn 2017 年 9 月 13 日
コメント済み: Henn 2017 年 9 月 14 日
Hey guys, I have attached my script in this question. I want to be able to simulate my script 1000 times so that I can have a 1000 values for certain variables in my script near the end.
Please note that within my script there is already a simulation at the beginning (i.e. As part of the simulation that I want, each one will have a part that is being simulated 1000 times.)
Thanks in advance for your help.

採用された回答

Image Analyst
Image Analyst 2017 年 9 月 13 日
for k = 1 : 1000
Overall_Omega_Model();
end
Change your script into a function if you want to return any values from it so they can be saved by your "Monte Carlo" program. It's not really a Monte Carlo program if it just calls your function 1000 times, unless maybe there is some randomness built into your Overall_Omega_Model script.
  7 件のコメント
Image Analyst
Image Analyst 2017 年 9 月 14 日
Just return all of the things in the output argument list. To define:
function [unconstrained, omegaopt_1] = Overall_Omega_Model()
Then, to call in your loop:
[unconstrained, omegaopt_1] = Overall_Omega_Model();
then do something with unconstrained and omegaopt_1, like tack them onto an array of values from all iterations, or whatever.
Henn
Henn 2017 年 9 月 14 日
Thanks a lot! Really Really appreciate your help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMonte-Carlo についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by