Hello everyone, I need to solve this problem in octave using the euler´s method (forward euler and backward euler) but I am not able. I was recommended this forum and was told that there were very smart people. If you could help me I would be very grateful.
Here is the problem:http://www.gomatlab.de/files/doc2_536.pdf
Here is the equation:http://www.gomatlab.de/files/captura2_566.jpg
Here is mi forward euler program:http://www.gomatlab.de/files/captura1_465.jpg
Sorry Jan S, my problem is to calculate the amount of population of predators and prey over time and the equation is Lotka-volterra type.
Here´s my problem: The Lotka-Volterra system of dierential equations is commonly used to model the evolution of two populations of predators NP and prey Np. The
following hypotheses hold:
1. Prey population increases proportionally to the number of prey (with
constant 'alpha') but is destroyed by predators at a rate proportional to the prod-
uct of the numbers of prey and predators (with constant 'beta').
2. Predator population decreases at a rate proportional to the number of
predators, but increases at a rate again proportional to the product of the
numbers of prey and predators. The constants associated to each event are
'gamma' and 'delta', respectively.
Solve the systems of ODES up to t=15
- Find by trial and error an adequate time step.
-Plot the time evolution of both populations.
-Plot the populations of predators vs. the population of prey.
HELP:
A matlab code for integration of systems of ODE using Forward-Euler is
provided
Here´s my function:
Code:
function y=growth(u,v,t)
%Data:
Prey=70000;
Predator=20000;
alpha=1.2;
beta=0.00006;
gamma=0.8;
delta=0.00005;
endtime=15;
if(t<???)
fun=inline('Prey*(alpha-beta*Predator)'); %first equation
else
fun=inline('Predator*(delta*Prey-gamma)'); %second equation
end end
They should leave lotka-volterra type graphics like this (http://www.gomatlab.de/files/captura3_367.jpg) and instead I get exponential graphs, but I do not know where I made the mistake or the time step I have to use to do it .
Please I need help, if anyone knows how to solve it I would be very grateful. I guess it is not difficult to do but my knowledge of matlab is limited.
[EDITED, Jan, Please use the Code formatting - Thanks!]
Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen. Du kannst Dateien in diesem Forum posten Du kannst Dateien in diesem Forum herunterladen
MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.