How to set a Tmax and successfully implement it in Simbiology?
Hygge
on 9 Jun 2025
Latest activity Reply by Florian Augustin
on 11 Aug 2025
I want to observe the time (Tmax) to reach maximum drug concentration (Cmax) in my model. I have set up the OBSERVABLES as follows (figure1): Cmax = max(Blood.lL15); Tmax_LT = time(Conc_lL15_LT_nm == max(Conc_lL15_LT_nm)); Tmax_Tm = time(Conc_lL15_Tumor_nm == max(Conc_lL15_Tumor_nm)); After running the Sobol indices program for global sensitivity analysis, with inputs being some parameters and their ranges, the output for Cmax works, but there are some prompts, as shown in figure2. Additionally, when outputting Tmax, the program does not run successfully and reports some errors, as shown in figure2. How can I resolve the errors when outputting Tmax?


1 Comment
Time DescendingHello,
the error message indicates that model simulations failed. The problem is likely caused by SimBiology’s validation of observables. Observable expressions must always either return a scalar value or a vector of the same length as the time value. Expressions like Tmax = time(conc == max(conc)) can return a scalar, but they can also return a vector, i.e., if the concentration is constant. The case of conc being constant is probably not occurring during your analysis, but it is detected during the validation of the observable before model simulation.
To work around this validation issue, you can create a function
function tMax = calculateTmax(time, conc)
tMax = time(conc == max(conc));
% This assumes that only the concentration assumes its max. at a
% unique time tMax.
tMax = tMax(1);
end
that calculates Tmax and ensures a single time is returned. Please safe this function in a script calculateTmax.m in a folder that is on the MATLAB path. You can either save the m-file in your current folder, or add the folder containing this file to the path.
You will then be able to calculate the observable by specifying the expressions as follows:
Tmax_LT = calculateTmax(time, LT.IL15)
Tmax_Tm = calculateTmax(time, Tumor.IL15)
I hope this helps.
-Florian
Sign in to participate