- Open your model in the SimBiology app.
- Click on the 'Simulation' tab in the toolstrip at the top.
- In the 'Simulation Settings' section, you will find an option to specify the 'Time (s)' or 'Time (hr)', depending on the units you are using.
- To specify the time points, you can manually enter a vector of times at which SimBiology will perform the simulation. For example:
- For 50 sampling points, you would create a vector that goes from 0 to 120 hours with 50 equally spaced points. You can use the linspace function in MATLAB for this:
time_vector = linspace(0, 120, 50);
For 100 sampling points, simply change the last argument of linspace to 100:
time_vector = linspace(0, 120, 100);
- Enter the generated time vector into the 'Time' field in the simulation settings.
Please note that the exact steps may vary slightly depending on the version of MATLAB and the SimBiology app you are using. If you are setting this from a script or the command line, you would use the simbiology command to simulate the model, passing in the time_vector as one of the arguments.
If you're running simulations from the command line or a script, you can use the sbiosimulate function. For example:
m = sbiomodel('my_model');
cs = getconfigset(m, 'active');
set(cs, 'SolverType', 'ode15s');
set(cs, 'StopTime', 120);
time_vector_50 = linspace(0, 120, 50);
[~, ~, output_50] = sbiosimulate(m, cs, time_vector_50);
time_vector_100 = linspace(0, 120, 100);
[~, ~, output_100] = sbiosimulate(m, cs, time_vector_100);
In the above example, output_50 and output_100 will contain the simulation results for 50 and 100 sampling points
respectively. Each row in the output corresponds to a time point, and each column corresponds to a model component (e.g., species concentration).
It's important to set the StopTime property of the config set to match the last point in your time vector, and to make sure the solver type is appropriate for your model.
---------------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.