Multiple parameter sweep in parfor using rapid accelarator mode

3 views (last 30 days)
I am looking at the below example model
Mb_sweep = Mb*(0.5:5:45.5);
iterations = length(Mb_sweep);
for i = iterations:-1:1
parameterSet(i) = Simulink.BlockDiagram.modifyTunableParameters(rtp, ...
'Mb',Mb_sweep(i));
end
simout(iterations) = Simulink.SimulationOutput;
I am trying to address a similar problem but with a larger list of parameters. i.e. instead of just Mb as in the above case, i have 5 parameters ( i have around 20 parameters but limiting to 5 as an example here). I have a cell array with a list of parameters (param_list) and a parameter sweep matrix with all the 5 parameters for 100 iterations (param_values (5 by 20 matrix). So below is how it looks
param_list ={a,b,c,d,e};
param_values=[1,2,3,4,5;... 100 rows];
Is there an elegant way to update all the 5 parameters using modifyTunableParameters but without hard coding them? I feel that it is silly to have to hard code a long list of parameters.
Once the parameterSet is created, i will be using it in a parfor loop. So, please consider the parfor limitations while providing a solution.
  2 Comments
Swarooph
Swarooph on 4 Nov 2016
The example you are referring to actually shows rapid accelerator execution with parfor. It does look like you might need to create a parameter set using a for loop for each simulation run.
Just out of curiosity, when you say
Is there an elegant way to update all the 5 parameters using modifyTunableParameters but without hard coding them? I feel that it is silly to have to hard code a long list of parameters.
Do you have desired workflow in mind?
Ramesh Saagi
Ramesh Saagi on 18 Nov 2016
Hi,
I used this example as it is directly available on the mathworks website. Not exactly sure what you mean by desired workflow.
The exercise i have in mind is
  1. using modifyTunableParameters, set the parameter names and values for 15 parameters to run for 100 simulations.
  2. I would then use this paramset to run paralllel simulations in parfor.
The question is if i can set the 15 parameters using a list of variables (param_list) and their corresponding values (param_values) for 100 simulations without hardcoding all the 15 variable names like
parameterSet(i) = Simulink.BlockDiagram.modifyTunableParameters(rtp, ...
'Mb',Mb_sweep(i), Mc, Mc_sweep(i), Md, Md_sweep(i));
instead something like
parameterSet(i) = Simulink.BlockDiagram.modifyTunableParameters(rtp, ...
param_list,param_values(i));

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!