MATLAB Answers

Question on specifying input to sbiosimulate

3 views (last 30 days)
Deepa Maheshvare
Deepa Maheshvare on 27 Apr 2019
Commented: Jeremy Huard on 2 May 2019
I'm using sbiosimulate to solver the model loaded from an xml file
[t, x, names] = sbiosimulate(modelObj);
modelObj has the following
Model Components:
Compartments: 3
Events: 0
Parameters: 193
Reactions: 40
Rules: 5
Species: 60
I want to change the values of 10 parameters present in modelObj while calling sbiosimulate.
Could someone suggest how this can be done?
For example,
While using ode15s I can easily do this using
ode45(@(t,z)model(t,z,c), tSpan, z0);
Where c is the vector containing the values of the 10 parameters.
Any suggestions?


Sign in to comment.

Answers (2)

Jeremy Huard
Jeremy Huard on 29 Apr 2019
Edited: Jeremy Huard on 29 Apr 2019
There is multiple ways to do this:
1- if you want to run multiple simulations, I recommend to use a SimFunction that will take a matrix of parameter values as input. Please refer to this post: Tips and Tricks: Use SimFunction for easy and fast model simulations in scripts
2- if you run a single simulation, you can create a variant with sbiovariant, add content to it with addcontent and pass it to sbiosimulate. When you pass this variant to sbiosimulate, the values in this variant will be used for simulation instead of the values stored in the model.
An easier way to create it is to use the App.
3- you can modify parameter values in the model itself. For this, you can use sbioselect to select the object corresponding to your parameter and change its value with the dot notation (parObj.Value). However, I don't recommend this method because this change will persist for the rest of your analysis, which might not be what you want.


Deepa Maheshvare
Deepa Maheshvare on 29 Apr 2019
I'm implementing 1- and 2- to perform customized optimization as mentioned here .
I've done the following
  1. Created a simFunction
SimFunction = createSimFunction(modelObj,params,observables,dosed, ParameterVariant);
with params = A cell array with the ids of 10 parameters that I want to estimate
observables = ids of species in the model
doesd = [ ]
ParameterVariant = Varant containing Parameter(Type) ,Parameter Name(Nmae), 'Value',value (of all 10 parametrs in params)
I'd like to simulate the mode using this SimFunction
simdata = SimFunction([],t_stop)
I'd like to know whether it would be correct to integrate this with the fimcon optimizer in MATLAB. I'd like to use fmincon to specify the non linear constraints and compare these results with that obtained from sbiofit as suggested here(where non linear constraints aren't used).
Jeremy Huard
Jeremy Huard on 29 Apr 2019
Hi Deepa,
let's please focus on one single thread because all your questions are spread over mutliple threads and one looses the context of your original question.
Let me summarize my recommendations here:
  1. in my opinion, you should forget the idea of using nonlinear constraints because you're constraining your simulation over the whole timespan. What really interests you is that your system reaches a steadystate that corresponds to your data.
  2. I strongly recommend to use sbiofit that will give you access to confidence intervals. This will be great to evaluate the identifiability of your parameters.
  3. I strongly recommend to use the App if you're new to SimBiology. I like to program myself but I use the App every day as it makes me more efficient. Once I have set a task, you can generate the code associated to it if you want to capture this in a script.
  4. To use sbiofit (or the fit task in the App, which is the same thing), generate a table with one line for a time that you think is long enough for your system to reach steady state.
  5. If you're unsure about this time and prefers to use sbiosteadystate, which tries to compute the steady state algebraically, this is fine. You can use sbiosteadystate in an objective function that you pass to fmincon or lsqnonlin.
  6. Whether you use the method in 4 or 5, you can call sbiosteadystate after your optimization with the optimized parameter values to get the species concentrations at steady state. They will be saved in the variant returned by sbiosteadystate. Then you use it to start simulation at steady state.
  7. Whether you use 4 or 5, you won't need to use SimFunction. But SimFunction are an alternative to sbiosteadystate in the objective function if you simulate long enough.
Deepa Maheshvare
Deepa Maheshvare on 30 Apr 2019
Hi ,
I used the App , uploaded the dataset as advised by you.
I get the following message after performing sbiofit,
"The right-hand side of the system of SimBiology ODEs results in infinite or NaN values. This usually indicates a modeling error and can lead to solver integration errors"
However,I could successfully obtain steady state solution prior to performing paarmeter estimation task . My system is stable with negative eigen values.
I'm not sure how to interpret the above message.
Any suggestions?

Sign in to comment.

Jeremy Huard
Jeremy Huard on 2 May 2019
Hi Deepa,
there might be different reasons to get this error message. A typical one is when one of the fluxes becomes Inf or NaN, for instance when it contains a division by 0. Another reason could be that you use a proportional error model for data that gets close to 0. If this is the case, you can try whith a constant error model.
Checking the valus of fluxes might be tedious. Maybe I can help if you can share your SimBiology file.


Deepa Maheshvare
Deepa Maheshvare on 2 May 2019
Thank you very much for the responce. I'm not sure how to set up "constant error model" in the app. I' referring to the documentation available here.
I tried performing optimization choosing fmincon in the app. I'm attching the report here for your kind reference.
Could you please share an email id on which I can send my SimBiology file?
Jeremy Huard
Jeremy Huard on 2 May 2019
Hi Deepa,
please send your model to jhuard at the domain of this website.

Sign in to comment.




More Answers in the  SimBiology Community

Community Treasure Hunt

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

Start Hunting!