- This documentation page lists simulation troubleshooting tips.
- The SimBiology Model Debugger allows you to step through simulation, inspect values, and detect common problems like negative values.
Simbiology in app model simulation
5 次查看(过去 30 天)
显示 更早的评论
Hello team and community,
I am currently working on a pharmacokinetic project that involves using a transit compartment model (DOI: 10.1007/s10928-007-9066-0) to describe drug absorption.
I have constructed the model using the Simbiology app and have written a script for a specific function usede in the model (attached in the files).
For the solver type, I have selected Sundials.
However, I have encountered some strange results when carrying out simulations using the in-app model simulation functionality.
I noticed that when I set the stop time from 1 to 7 hours, the simulation results appear to be fine.
However, when I set the stop time to 8 hours or above, the simulation results show some unexpected behavior that I cannot comprehend.
[stop time = 7 hour]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1433208/image.png)
[stop time = 8 hour]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1433213/image.png)
[stop time = 48 hour]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1433218/image.png)
I would greatly appreciate it if you could provide me with some insights into this problem.
Thank you very much.
Jesse
0 个评论
采纳的回答
Arthur Goldsipe
2023-7-12
I think the problem comes down to the way that calculate_KTC depends on time. This function has a maximum around a time of 1. If you are not careful with the solver options, the initial time steps result in a KTC that is so small that the solver might take a large time step that overshoots the large values in KTC and instead once again results in KTC values that are very small. So the solver never steps through a time range where KTC is large enough to cause a significant change.
There are several solver options you could change to fix this. But for this specific situation I would probably set MaxStep to something like 0.1 or 1. The exact value probably doesn't matter too much, but I wanted to pick something that would ensure the solver steps to to a time where KTC is significantly large. As with many of these solver options, you should be caeful not to set it to too extreme of a value. If you constrain the solver too much, simulations may take much longer than necessary. But if you don't constrain the solver enough, your results will be inaccurate. So in general you may need to use a bit of trial and error.
I also want to point you to a couple of other resources that can be useful when you have simulation errors:
-Arthur (he/him/his)
更多回答(0 个)
社区
更多回答在 SimBiology Community
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scan Parameter Ranges 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!