With the new ODE command (matlab 2024a), I'd like to parametrize the ICs and make, for example, x0=[p(1); p(5)] and then compute SENSITIVITIES!

10 次查看(过去 30 天)
Hi, I was pleased to see that the SUNDIAL routines now become available on a lower level with the new ODE command. I'd like to use CVODES for computation of a solution + parametric sensitivities. However, I need to make one (or more) of the ICs for x (say, x0) to be parameters instead of numerical values. Right now this is not possible.
Are you intending to make the IC a function handle, so that I can say
x0 = @(p) [p(1); p(5)]
where the dynamics are given by a non-linear state space model xdot = f(x,u,p) and x is the vector with state variables x_i, for example? Would be really nice to have this, since then I can perform my analysis. I have a work around now, but do not like this solution. My ultimate goal is to include automatic differentation for all Jacobi matrices, including the IC (!), and get a very accurate solution for the sensitivities in this way.
Thanks in advance for your help.
  2 个评论
John D'Errico
John D'Errico 2024-6-3
I think you misunerstand what Answers is. You seem to be talking to "us" as if we have some control over the behavior of MathWorks supplied code. (That is, you use the words "are you intending" in your question.) We don't write the code. In general, we are not even employees at TMW. Answers is not technical support. It is not a direct line to the people who have written the code you use.
Hans
Hans 2024-6-3
@John D'Errico: OK + thanks. Yet, the question is still relevant, I think. Are there people out there who know how to deal with a parametrized IC for computation of sensitivities? Any experience with this issue would be appreciated.

请先登录,再进行评论。

采纳的回答

Steven Lord
Steven Lord 2024-6-3
If I understand what you're asking, I think you could just modify the Examine Parameter Sensitivity example on the ode documentation page to use the value of the variable p as the InitialValue property rather than using [2 3].
If you want to do this analysis for many different parameter values, just change the value of the InitialValue property of F then call solve in a loop.
If you're asking if you can specify the InitialValue as something like a symbolic variable (syms n and use n in InitialValue), the answer is no, not with the ode object. There are some differential equation solver functions in Symbolic Math Toolbox.
If that's not what you're looking for, please describe your goal in a little more detail, perhaps with a small example of actual equations similar to what you're trying to solve.
  1 个评论
Hans
Hans 2024-6-4
Thanks a lot, Steven. By specifying the Initial Values of the sensitivities via odeSensitivity(InitialValue=..) I can now do what I want. A small example to clarify + you were asking for:
xdot = -p(1) * x(1)
x(0)=p(1) * p(2)
The forward sensitivity eqns (where x_p is a matrix in general) are
x_p dot = df/dx * x_p + df/dp
x_p(0) = dx0/dp
and we get for my example:
x_p dot = -p(1) * x_p + [-x(1) 0];
x_p(0) = [p(2) p(1)];
I can compute the Jacobi matrices df/dx, df/dp, dx0/dp with Automatic Differentiation (I use ADImat for that) and pass these Jacobi matrices over to the SUNDIAL solver with the odeSensitivity command.
It would be very nice if Matlab would facilitate automatic differentiation for sensitivity computations. I think this done in the SimBiology toolbox, but it would be great if the new ode command also would have this facility. Why? For identifiability analysis of the parameters in my model I need a very accurate answer for the parametric output sensitivities. If you're interested: I wrote a few papers on this. Regards, Hans

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by