Run Multiple Simulations - MATLAB & Simulink (original) (raw)

Main Content

Provide collection of inputs to model and run multiple simulations with these inputs using the parsim function, thebatchsim function, or the Multiple Simulations panel in Simulink®

For workflows that involve multiple parallel simulations and logging of large data, you can use the parsim orbatchsim function, or run the simulations with theMultiple Simulations panel in the Simulink Editor.

With a Parallel Computing Toolbox™ license, you can use the parsim function to run the simulations in parallel. The function distributes multiple simulations to parallel workers to speed up overall simulation time. Using the parsim function with Parallel Computing Toolbox allows you to automate the creation of parallel pools, identifies file dependencies, and manages build artifacts for accelerator and rapid accelerator simulations. The parsim function runs simulations in serial if a Parallel Computing Toolbox license is not available.

You can use the batchsim function with Parallel Computing Toolbox and MATLAB® Parallel Server™ licenses. When you use the batchsim function, simulations are offloaded onto a compute cluster. You can open a separate MATLAB session to access the job and the results.

To get started, see Running Multiple Simulations and Run Parallel Simulations for a Thermal Model of a House Using parsim.

Objects

Functions

expand all

batchsim Offload simulations to run on a compute cluster
parsim Simulate dynamic system multiple times in parallel or serial
applyToModel Apply configuration in SimulationInput object to model
setBlockParameter Set block parameter values for simulation usingSimulationInput or Simulation object
setModelParameter Set model parameter values for simulation usingSimulationInput or Simulation object
setInitialState Specify initial state for simulation usingSimulationInput or Simulation object
setExternalInput Specify external input data for top-level input ports usingSimulationInput or Simulation object
setVariable Set variable values for simulation usingSimulationInput or Simulation object
setVariantConfiguration Set variant configuration for simulation using SimulationInput object (Since R2024a)
getVariantConfiguration Get name of variant configuration from SimulationInput object (Since R2024a)
validate Validate contents of SimulationInput object
setPreSimFcn Specify MATLAB function to run before start of each simulation onSimulink.SimulationInput object
setPostSimFcn Set MATLAB function to run after each simulation
loadVariablesFromMATFile Load variables from MAT file into Simulink.SimulationInput object
loadVariablesFromExternalSource Load variables from a custom file into Simulink.SimulationInput object (Since R2022b)
getSimulationJobs Get all Simulink.Simulation.Job objects from cluster
showContents View summary of specification in SimulationInput orSimulation object

Tools

Topics