I want to run a Monte Carlo Simulation on my entire script, How do I do it.
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!