Running multiple simulations simultaneously

1 visualización (últimos 30 días)
Deepa Maheshvare
Deepa Maheshvare el 21 de Oct. de 2019
Respondida: Sai Sri Pathuri el 6 de Nov. de 2019
I'm solving a system of odes present in function1 for different set of initial conditions.
for i = 1:10
x0 = rand(10,1)
[t x] = ode15s(@(t,s) function1(t,s), tspan , x0);
field = "x" + num2str(i);
soln.(field) = x
end
I'd like to run these simulations parallely, i.e. for all i's at once.
Could someone suggest how this can be done?
  2 comentarios
Stephen23
Stephen23 el 21 de Oct. de 2019
Editada: Stephen23 el 21 de Oct. de 2019
Deepa Maheshvare
Deepa Maheshvare el 21 de Oct. de 2019
Could you please explain a bit more? I'm not sure if I understand

Iniciar sesión para comentar.

Respuesta aceptada

Sai Sri Pathuri
Sai Sri Pathuri el 6 de Nov. de 2019
You may use parfor loop to execute the iterations parallelly. The documentation for parfor loop can be referred from the following link

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by