I'm looking for getting the matlab codes for soving nonlinear differential equations? These equations are from a research paper on HIV AIDS.

2 次查看(过去 30 天)
These equations are from Mathematical Modelling of HIV AIDS Dynamics with Treatment and Vertical Transmission.

采纳的回答

Are Mjaavatten
Are Mjaavatten 2017-12-20
编辑:Are Mjaavatten 2017-12-20
Matlab has several functions for integrating systems of differential equation. Type
doc ode45
for more information.
In your case, start by creating a Matlab function that calculates the right-hand side of your equations. Here is a skeleton to get you started:
function dzdt = rhs(t,z,par)
% Right-hand side of differential equations
% par: Parameter struct
% Unpack vector of dependent variables:
S = z(1);
I = z(2);
P = z(3);
T = z(4);
A = z(5);
dSdt = pi*par.N - (par.c(1)*par.beta(1)*I + par.c(2)*par.beta(2)*P)...
*S/par.N - % ... and so on
% In the same way for the remaining equation
dzdt = [dSdt;dIdt;dPdt;dTdt;dAdt];
end
Next, write a Matlab script where you:
1) Define parameters
par.N = 200;
par.c = [2.3,-127.4];
2) Specify initial conditions:
S0 = 0; I0 = 2.4; % ... and so on
z0 = [S0;I0;P0;T0;A0];
3) Specify integration interval and call the solver:
tmax = 1; % Start with a low end time for debugging purposes
[t,z] = ode45(fun,[0,tmax],z0); % You may have to try alternative solvers
4) If all goes well you may plot results:
S = z(:,1);
I = z(:,2);
plot(t,S,t,I);

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by