Increase simulation time in Monte Carlo simulations in Matlab / Simulink

I am running a Monte Carlo simulation for a Simulink model with a Matlab script that looks something like this:

model = 'modelName'; load_system(model) for ii = 1 : numberOfMC % Some set_param... % Some values are set sim(model); results{ii, 1} = numberOfMC; % ect... end close_system(model,0); 

As the number of tests in Monte Carlo increases, the time of one simulation increases as well as n ^ 2.

Is there a simple explanation for this, and is there a decision to have something linear in time?

Thanks!

EDIT:

When I divide my simulation into 6 batches, and I run them sequentially, the sum of the simulation time is much less than when I run the entire simulator with one shot.

+6
source share
1 answer

There seems to be a limitation on what can be done without feedback from me. I will just post my comment as an answer:

My bet would be a memory problem, if you want to fix it, look, there is still a problem, if you do not save the result in the first place, just delete this line:

 results{ii, 1} = numberOfMC; 

Also make sure that you don't have other growing variables or that you accidentally make input more complicated when you go. It probably doesn't matter since time also increases if you model everything in reverse order? Or, if you perform the full number of iterations, but each time with exactly the same input?

+1
source

Source: https://habr.com/ru/post/959332/


All Articles