How to use parsim inside for loop?
조회 수: 9 (최근 30일)
I have two for loop for simulink simulation. The for loop values are used by the simulink model for simulation. I would like to spped up the simulation by using parsim command. My m.file code look like something this,
Here, I would like to change the sim command by parsim. What should I do?
Samyuktha 2023년 4월 3일
It is my understanding that you want to speed up the simulation by using 'parsim' command.
You can replace the 'sim' command with 'parsim' to simulate dynamic system multiple times in parallel or serial. Please refer to the following documantation links for more details on how to use the 'parsim' command:
Hope this helps!
Meet 2023년 4월 3일
The parsim function runs simulations with different parameters and values based on the Simulink.SimulationInput object. Each Simulink.SimulationInput object specifies one simulation of the model. Therefore, you can create an array of Simulink.SimulationInput objects and then assign the for loop values to the respective parameter of the Simulink.SimulationInput object from the array. Then you can pass this array of Simulink.SimulationInput objects to parsim. This will result in parallel simulations of all the models with different parameters configured for each simulation.
Please refer Run Parallel Simulations - MATLAB & Simulink (mathworks.com) for more details on how parsim works and how to use it.
Also refer Run Parallel Simulations for a Thermal Model of a House Using parsim - MATLAB & Simulink (mathworks.com) for an example on how to use parsim.