How can I get species B = cummax(species A) in SimBiology?

I have a species which will change in a bell shape (starts decreasing after monotonically rising to a peak) over time and I was wondering how I can calculate a parameter (or species) value which is equal to cummax(species) every time step in SimBiology Desktop?
For instance, B = cummax(A). However, A is an instantaneous species value whose size is equal to 1, but in order to calculate cumulative maximal value of A, I need to store a vector of A as far as I know.
Many thanks!

Respuestas (1)

Hi Dooyoung,
In SimBiology, you cannot create a species or parameter that is a vector. You can however analyze a simulation after it has finished to determine the cumulative maximum of a species (cummax). If you have the results stored in a SimData object named 'sd', you can create a vector of the cumulative maximum of A as follows:
[time, A] = selectbyname(sd);
B = cummax(A);

1 comentario

Dooyoung Lee
Dooyoung Lee el 5 de En. de 2015
Editada: Dooyoung Lee el 5 de En. de 2015
Hi Arthur,
Thank you for the quick reply and confirming the thing which SimBiology cannot create a parameter that is a vector. However, I may need to calculate the cummax(A) every time point, but not after the simulation because the cummax value will affect another reaction calculation.
Currently, I added an repeated assignment with a myfunc which saves and loads a temporary cummax value as follows,
function maxA = mycummax(time, A)
load('tempA.mat');
tempA = [tempA; A];
maxA = max(tempA);
tempA = maxA;
save('tempA.mat', 'tempA');
However, it made the simulation much slower because the repeated assignment and the customized function cannot be accelerated. Would it be another way to accelerate the calculation with the function?
Best,

Iniciar sesión para comentar.

Comunidades de usuarios

Más respuestas en  SimBiology Community

Categorías

Más información sobre Extend Modeling Environment en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 23 de Dic. de 2014

Editada:

el 5 de En. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by