Eq points of a set of ODEs with parametric values
3 views (last 30 days)
Show older comments
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;
0 Comments
Answers (1)
Rijuta
on 24 Feb 2023
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.
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!