Main Content

simulink.multisim.Exhaustive

Create an exhaustive parameter combination for specified parameter values

Since R2024a

Description

The simulink.multisim.DesignStudy object represents a design study that allows you to run multiple simulations at a large scale. With the simulink.multisim.Exhaustive object, you can create an exhaustive parameter combination for simulations. An exhaustive combination creates all possible combinations of parameter values that you specify.

Creation

Description

ec = simulink.multisim.Exhaustive([p1, p2,...,pN]) creates a parameter combination, ec with all possible combinations of the specified parameters.

example

Input Arguments

expand all

Parameters to create a exhaustive combination for simulation, specified as an array.

Output Arguments

expand all

Specified combination of parameters, returned as a simulink.multisim.Exhaustive object.

Properties

expand all

Parameter space containing the parameter combination object for massive simulations, returned as a simulink.multisim.Exhaustive or simulink.multisim.Sequential object. A parameter space may contain nested combinations of simulink.multisim.Exhaustive and simulink.multisim.Sequential objects.

Examples

collapse all

Use the simulink.multisim.ExternalInput function and simulink.multisim.Variable to specify external data and variables for the simulation configuration stored in a simulink.multisim.DesignStudy object. Then, create a parameter space with exhaustive combinations of the external input data and variables. Finally, run the simulation using the simulink.multisim.DesignStudy object.

Open the model LoadInputData. The model contains one Inport block that is connected to a Gain block with a Gain value set as variable 'g'. The output of the Gain block is connected to an Outport block.

mdl = "LoadInputData_DesignStudy";
open_system(mdl)

The model LoadInputData

Create input data to load using the Inport block. For this example, create data that represents a sine wave using an evenly spaced vector of time values. Then, use the sin function to create a signal value for each time point.

sampleTime = 0.1;
numSteps = 100;
time = sampleTime*(0:numSteps);
time = time';

data = sin(2*pi/3*time);

You can specify external input data for top-level input ports using several formats. For this example, use the timeseries format. To create a timeseries, the time data must be a duration vector.

inData = timeseries(data, time);

Use the simulink.multisim.ExternalInput function to add the external input data inData.

extIn = simulink.multisim.ExternalInput(inData)
extIn = 
  ExternalInput with properties:

           Values: [1×1 timeseries]
    ProcessingFcn: @(x)x

You can also configure other aspects of the simulation using the Simulink.SimulationInput object, such as block parameter values, model configuration parameter values, and variable values.

Suppose you want to configure values for Gain block, and create a combination of external input values and gain values for the simulation. Use the simulink.multisim.Variable to specify a range of 10 values for the variable 'g'.

var = simulink.multisim.Variable("g", 1:10)
var = 
  Variable with properties:

             Name: "g"
           Values: [1 2 3 4 5 6 7 8 9 10]
        Workspace: "global-workspace"
    ProcessingFcn: @(x)x

An exhaustive combination of parameters is defined as all possible combination of two specified parameters. Use the simulink.multisim.Exhaustive function to create a parameter space that contains all combinations of the specified external input and variables.

exComb = simulink.multisim.Exhaustive([extIn var])
exComb = 
  Exhaustive with properties:

    ParameterSpaces: [1×2 simulink.multisim.SingleParameterSpace]

ds = simulink.multisim.DesignStudy(mdl, exComb)
ds = 
  DesignStudy with properties:

         ModelName: "LoadInputData_DesignStudy"
    ParameterSpace: [1×1 simulink.multisim.Exhaustive]
         PreSimFcn: @(simIn)simIn
        PostSimFcn: @(simOut,simIn)simOut
           NumSims: 10

Simulate the model using the configuration on the SimulationInput object.

f = parsim(ds);
[21-Apr-2025 15:57:21] Checking for availability of parallel pool...
[21-Apr-2025 15:57:21] Starting Simulink on parallel workers...
[21-Apr-2025 15:57:23] Configuring simulation cache folder on parallel workers...
[21-Apr-2025 15:57:23] Loading model on parallel workers...
[21-Apr-2025 15:57:26] Running simulations...

Version History

Introduced in R2024a