must I use events for discontinuous functions?
Show older comments
A previous question asked about input a function of time. A function y = exp(-k*t) was input, with errors. The answer from Mathworks was that Simbiology was designed for ODEs, and recommended putting the expression in ODE form. I hadn't read that, and put in a rate expression (as a repeat assignment to rate r1, which was used in a rate law) of r1 = alpha * time * exp(-time/beta).
Simbiology may have improved since then, though, because this worked when I used the variable "time". However, I want to repeat this function periodically in simulations. I don't see how dosing could be used for an expression of time. Not sure how events would work, either. I want to repeat this (for example, every 1440 minutes). So I assumed that "time" was a system variable and used it in a repeat assignment of clocktime = mod(time,minperday), with minperday=1440 minutes. This gave results that were not expected. clocktime ended up being delivered as a piecewise continuous function that changed with a piecewise constant rate, with discontinuities somewhat random in timing and magnitude. I couldn't figure out how SB was getting the strange shape.
So I've created a species falsetime. Because it's a species, I had to use units of grams. d(falsetime)/dt = timefont. timefont = 1 gram/minute. Then I used liecon (converting the lie) of 1 minute/gram. And so I can then get clocktime = mod(falsetime*liecon, minperday) to get a sharktooth function. Problem is, the integrator is not good at picking up discontinuities (not criticizing, most extrapolation integrators are bad at this). So the sharktooth function is somewhat irregular. To fix this, I set the max time step in the integrator to 1 minute. This gives me a fairly uniform shark tooth. The question arises, could I set up an arbitrary event for every 1440 minutes, to force the integrator to catch my discontinuity? Is there a better way to do what I'm trying to do?
Accepted Answer
More Answers (2)
Jim Bosley
on 9 Mar 2018
0 votes
Arthur Goldsipe
on 9 Mar 2018
0 votes
Hi,
The only other reserved word is "null", which is used in reactions when there are no reactants or no products. For example, "null -> x" denotes a production reaction for x. The restrictions on names are discussed here: https://www.mathworks.com/help/simbio/ref/name.html
Categories
Find more on Scan Parameter Ranges in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!