Vector Variables, Preload, and External matlab functions (in m files) in Simbiology
Show older comments
In a previous question, I asked about how to switch between using an ODE-calculated species value, and a forced function fit. In response to some very useful interaction with the Mathworks experts (thank you Arthur), I now have a model with an ODE-calculated species value (x_ODE), a parameter whose value is set by a repeat-assignment-rule parameter (x_forced), a switch (switch_force) and a species whose value is set to either x_ODE or x_forced based upon the switch using a repeat assignment (you could use two repeat assignment rules as well, and select one active and the other not). This node (x_used) is the value used wherever needed (that is, where x_ODE would normally appear).
So I can set x_forced=sin(time) as a test case, and that works. This is a good academic exercise, but few biological functions are based upon a pure sine wave. I'd like to use a spline function set x_forced. So I'd like to use x_forced = spline(tvec, xvec, time), where tvec and xvec are vectors of time and function value, and time is the system variable time.
So, some questions: 1) Can I use vector variables within simbiology? 2) If so, is there a preload function, as in Simulink that I could use to load the vectors to fix the simbiology variable values, prior to simulation? 3) If not, can simulink call external m files, so that my repeat assignment rule would be x_forced = x_external(time) and x_external.m would be an m. function file that (on first call) reads a file, and then (and on subsequent calls) uses the data loaded from the file, and the spline function, to return the value of x at time "time"?
SBML2 only allows for parameter values that are type "double" (SBML 2, section 4.7.2). I believe that this means scalar (parameters are all scalar in Pathway Designer, for example). But biological models sometimes need vector data!
Accepted Answer
More Answers (2)
Jim Bosley
on 14 Mar 2018
Edited: Jim Bosley
on 14 Mar 2018
Jim Bosley
on 15 Mar 2018
Edited: Jim Bosley
on 15 Mar 2018
0 votes
Communities
More Answers in the SimBiology Community
Categories
Find more on Import Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!