Solving non-linear differential system

I want to solve this non-linear differential system using matlab where :
sigma=2/3
mu=1/20
alpha=1/3
beta=2/3
gamma=1/3
b1=0
b2=0
b3=1/3
(S0,T0,I0,M0,R0)=(100000,50000,2753,2000,1645)

1 commentaire

Walter Roberson
Walter Roberson le 3 Juin 2021
If you have the Symbolic Toolbox, then that can make it easier to prepare the equations; after that you would follow the workflow in the first example in odeFunction() in order to construct a function handle to pass to a numeric solver.

Connectez-vous pour commenter.

Réponses (1)

You can use: syms to introduce the variables and then employ dsolve to get symbolic solutions, e.g.:
syms S(t) M(t) I(t) T(t) R(t)
dS = diff(S, t);
dM = diff(M, t);
...
sigma=2/3
mu=1/20
...
EQN = [dS == -sigma*S*T+mu*T-b1*S, dT == sigma*S*T+mu*T-(mu+alpha)*TS, ..];
SOL = dsolve(EQN, S(0)==100000, T(0)==50000,..);
SOL.S % Solution: S(t)
SOL.T % SOlution: T(t)
...
fplot(SOL.S, [0, 15])
...

1 commentaire

Walter Roberson
Walter Roberson le 4 Juin 2021
dsolve() works well... until it doesn't.
There are a lot of systems that dsolve() cannot resolve symbolically. In those cases it may be necessary to use odeFunction() to convert the symbolic system to a function for numeric solution.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by