Respuestas (1)

Arthur Goldsipe
Arthur Goldsipe el 8 de Jun. de 2015

0 votos

Hi Debora,
I can (and will) tell you a way you can explicitly enforce conservation laws, but I think it's first worth asking why you want to do that. If it's because your simulation results don't obey a conservation law you expect, then you may have a larger problem. The first question to ask is whether the difference is acceptable. Some rounding errors are the result of numerically solving the ODEs. If you need more accurate answers, then you may need to tighten the ODE solver tolerances. But note that sometimes you never get exactly the results you expect, due to machine precision (for example, .3 - .1 - .2 is not quite 0).
If you just want to make sure that you've correctly written your model, then you can use the sbioconsmoiety function to identify conservation laws.
If you still think you need to enforce conservation laws you can use a repeated assignment. For example, if your model had a single reaction "x -> y", you could alternatively formulate the model as "x -> null" with a repeated assignment of the form "y = x0 + y0 - x". In both cases, "x + y" would be conserved (excepting the numerical issues I mentioned earlier).
If that doesn't clear things up or you have additional constraints, then I recommend posting a new question to MATLAB Answers with more details. (People will be much more likely to see and answer a brand new question, rather than adding more answers to this one.)
-Arthur

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

Preguntada:

el 8 de Jun. de 2015

Respondida:

el 8 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by