Solution of DAE-System is too linear
1 次查看(过去 30 天)
显示 更早的评论
Hi guys, I have a homework assignment where I am supposed to use DAE systems to describe the ecological balance of forest stand, grass stand, bird population and insect population. I have implemented this, but I don't like my solution. It all looks so linear, which it shouldn't, and the bird population and insect population is growing far too slowly.
The equations in the task are as follows:
% Variable declaration
tspan = linspace(t1, t2);
% DGL-declaration
%x=x1; y=x2; z=x3
odefun = @(t,X) [ a*x*(1-(x/k))-h*x-f*y*(x/(x+d)); % DGL
b*y*(1-(y/(m*x*(k-x))))-g*z*(y/(y+e));
c*z*(1-(z/(n*x*y)))];
% Parameter declaration
x = 20; % Initial values
y = 0.001;
z = 0.0001;
conds = [x, y, z]; %Column vector for initial values (conditions)
% DGL solution
[t,X] = ode45(odefun, tspan, conds);
%plot the results
In case you are wondering where the insect population graph is, it is basically the bird population graph.
I hope you can help me find the error(s).
0 个评论
回答(1 个)
Torsten
2022-3-31
a = ...;
b = ...;
c = ...;
k = ...;
h = ...;
f = ...;
d = ...;
m = ...;
g = ...;
e = ...;
n = ...;
odefun = @(t,x,y,z) [ a*x*(1-(x/k))-h*x-f*y*(x/(x+d)); % DGL
b*y*(1-(y/(m*x*(k-x))))-g*z*(y/(y+e));
c*z*(1-(z/(n*x*y)))];
x = 20; % Initial values
y = 0.001;
z = 0.0001;
conds = [x, y, z]; %Column vector for initial values (conditions)
t1 = ...; % integration period
t2 = ...;
tspan = linspace(t1, t2);
% DGL solution
[t,X] = ode45(@(t,X)odefun(t,X(1),X(2),X(3)), tspan, conds);
plot(t,X) % plot solution
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!