Solve ODE using backward euler's method

22 vues (au cours des 30 derniers jours)
KC
KC le 12 Déc 2015
Commenté : KC le 14 Déc 2015
x' = λ - ρx - βxz;
y' = βxz - δy;
z' = py - cz;
x0=43100; y0 = 0, z0 = 0.0033, λ = 388, ρ = 0.009 δ = 0.18, p = 50000, c = 23, β=3.61e-8
Is there a built-in function in matlab to solve the above non-linear system using the backward euler's method?

Réponse acceptée

Torsten
Torsten le 14 Déc 2015
Initialize
x_old = 43100, y_old = 0 and z_old = 0.0033
Compute x_new by solving the nonlinear system of equations
(x_new-x_old)/dt = lambda - rho*x_new - beta*x_new*z_new
(y_new-y_old)/dt = beta*x_new*z_new - delta*y_new
(z_new-z_old)/dt = p*y_new - c*z_new
by fixed-point iteration or with MATLAB's fsolve, e.g.
This gives you the solution for your system at time t=dt.
Set
x_old = x_new, y_old = y_new and z_old = z_new
and solve the above system again for x_new, y_new and z_new.
This gives you the solution at time t=2*dt.
Continue until you reach t=tfinal.
Best wishes
Torsten.
  3 commentaires
Torsten
Torsten le 14 Déc 2015
As far as I know, Forward Euler evaluates the right-hand side with the old values:
(x_new-x_old)/dt = lambda - rho*x_old - beta*x_old*z_old
(y_new-y_old)/dt = beta*x_old*z_old - delta*y_old
(z_new-z_old)/dt = p*y_old - c*z_old
Best wishes
Torsten.
KC
KC le 14 Déc 2015
Thank you Mr. Torsten, I will try this code!

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 12 Déc 2015
No, there is no built-in function in MATLAB for that.
  2 commentaires
Walter Roberson
Walter Roberson le 13 Déc 2015
KC
KC le 13 Déc 2015
Is there an example somewhere of how to solve a system of ODE's using the backward euler's method? I would want to understand the concept first, so I can implement it in MATLAB. I googled for quite some time but was not able to find a proper example. Thanks!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by