Eq points of a set of ODEs with parametric values

4 次查看(过去 30 天)
Hi! I'm quite new to Matlab and I have a couple of questions:
I need to find the eq. points of a system of 3 ODEs, with some parametric coefficient (about which I know the value). In particular, the idea is to define the ODEs with all the parameters, set one of the parameters to zero, find the the eq points in a parametric shape, and then subtitute their value to get the numerical solution of the eq. points. That's because I need to evaluate different cases with different parameters, and I'd like to avoid to write the code for each case.
Here's what I wrote, can someone help me, please?
PS: I know that the equilibrium points can be defined by setting the first derivative = 0, but I need to keep the ODEs in their original shape for later steps.
clc;
clear;
close all;
% Definition of ODE system
syms s(t) e(t) i(t)
syms mu betaz q sigma gamma % Parameters
ode1 = diff(s) == mu - betaz * (1-q) * s * i - mu * s;
ode2 = diff(e) == betaz * (1-q) * s * i - (sigma + mu) * e;
ode3 = diff(i) == sigma * e - (gamma + mu) * i;
q = 0;
diff(s) == 0;
diff(e) == 0;
diff(i) == 0;
rz = (sigma * betaz) / ((mu + sigma) * (mu + gamma));
% Case 1
mu = 0.5;
betaz = 0.9;
sigma = 0.95;
gamma = 1/5;
eq1 = solve(ode1);
eq2 = solve(ode1);
eq3 = solve(ode1);
rz;

回答(1 个)

Rijuta
Rijuta 2023-2-24
Hi Mattia,
I understand that you are trying to implement your code for multiple cases without duplicating the code.
This can be done by storing the parameter values for each case in a data structure like a cell array and then loop through each case to solve the ODEs, in the same way as you have done for a single case.
I hope the above information helps in implementing the code for multiple cases.

类别

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

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by