cumulatives of the dynamical system

1 次查看(过去 30 天)
Suppose I have
where D(t) is the deaths at time t and solve the differential equation using ODE45. I now want to calculate the cumulative death
One way might be to take the sum of D(t) over all the steps. Is there a better way?

采纳的回答

Walter Roberson
Walter Roberson 2020-5-26
编辑:Walter Roberson 2020-5-26
You currently have a first order differential equation, diff(D,t) == x(t). When you use it with ode45 you would be using a function such as
odefun = @(t,x) X(t);
and the output you would get from this would be D, the integration of the system.
Now to get the integral of D, you can reframe it as a second order differential equation:
dE(t)/dt = D(t)
dD(t)/Dt = X(t)
odefun = @(t,x) [x(2); X(x(2))]
[t, X] = ode45(odefun, [0 1], E0) %E0 is boundary conditions D(0) and D'(0)
output = X(end,1)
That is, since what ode45 already does is numeric integration, then you can just add in another layer to tell it to do integration of D

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by