Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Image Analyst
Image Analyst am 13 Sep. 2017
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 Kommentare
Image Analyst
Image Analyst am 14 Sep. 2017
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 am 14 Sep. 2017
Thanks a lot! Really Really appreciate your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by