Я написал модель Lotka Voterra (prey-predator) как функцию Scilab и решил ее с помощью ODE. Моя проблема в том, что я хочу видеть эволюцию потоков. Я нашел решение, включив потоки в разрешение (в сценарии ниже только для одного), но он действительно «тяжелый». У кого-то есть лучшее решение?Как видеть/извлекать эволюцию потоков моделей при решении модели в функции Scilab?
//parameters
x=[0.04,0.005,0.3,0.2]
n = x(1);//birth rate of prey
c = x(2);//capture rate
e = x(3);//energy from capture
m = x(4);//death rate or predator
Tmax=100; // maximum time of simulation
dt=0.01; // step of time
t=0:dt:Tmax; //simulation time definition
Ci = [20,30,0]'; //initial conditions (including for 1 flow)
//Lotka Volterra model
function [dy]=LV(t, y, n, c, e, m)
GrowthP = n * y(1)
IngestC = c * y(1) * y(2)
MortC = m * y(2)
dy(1) = GrowthP - IngestC
dy(2) = IngestC * e - MortC
dy(3) = IngestC //here one flow in ode
endfunction
//resolution
sol=ode(Ci,0,t,LV)
//dataframe creation to stock data
soldef=zeros(3,10001);
//for the line 3 and form 2 to the last data it take the value,
//remove the one of the previous time step and store it in soldef
for i = 2:length(sol(3,:))
soldef(3,i)=sol(3,i)-sol(3,i-1);
end
//complete the dataframe with the stock
soldef(1:2,:)=sol(1:2,:)
Спасибо за интерес и время вы даете к моей проблеме (и извините за мой английский)