Having multiple doses or variants within a scenario

40 views (last 30 days)
Hello,
When generating SimBiology scenarios, is it possible for a given scenario to have multiple doses or variants, or must each scenario have at most one dose and at most one variant?
Thank you,
Abed

Accepted Answer

Florian Augustin
Florian Augustin on 22 Jan 2026 at 19:20
Hi Abed,
it is possible to create SimBiology scenarios with multiple doses or variants for each sample. It depends on how you would like to combine the individual doses / variants with other samples. Here is just one example where you can combine doses d1, d2, ... with samples for a model component named "param":
% Assume you have doses d1, d2 and model component named "param".
% Create scenario for doses:
doseScenario = SimBiology.Scenarios("dose 1", d1);
add(doseScenario, "elementwise", "dose 2", d2);
% ... add other doses
% Create scenario for model component "param" with uniformly distributed values between [1,2]:
uDist = makedist("uniform", "Lower", 1, "Upper", 2);
sObj = SimBiology.Scenarios("param", uDist, "Number", 5);
% Specify random seed if samples need to be reproducible: sObj.RandomSeed = 0;
% ... add more samples for other model states as needed
% Combine dose samples with parameter samples:
add(sObj, "cartesian", doseScenario);
% Display combined scenario
disp(sObj)
% Generate samples:
generate(sObj)
Let me know if you have a particular combination type you need. We should be able to create a SimBiology scenarios object to create samples for your use case.
I hope this helps.
-Forian
  3 Comments
Hans Scharler
Hans Scharler on 22 Jan 2026 at 22:57
Does this same approach work in the SimBiology Model Analyzer app?
Florian Augustin
Florian Augustin on 23 Jan 2026 at 13:33
Hello Hans,
yes, this also works in SimBiology Model Analyzer. When you open a Generate Samples program or a Run Scan program, you can define SimBiology scenarios in the GENERATE SAMPLES section as PARAMETER SETs. Create one parameter set for the doses with Parameter Combination "elementwise" and another parameter set for the model component values. Then combine the two parameter sets by specifying a "cartesian" combination (which is already the default) of the two sets by clicking on the icon in the Combination column of the table in section PARAMETER SET COMBINATIONS.

Sign in to comment.

More Answers (0)

Communities

More Answers in the  SimBiology Community

Categories

Find more on Scan Parameter Ranges in Help Center and File Exchange

Products


Release

R2025b

Community Treasure Hunt

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

Start Hunting!