How to use Euler's method to solve the logistic grown model?
Show older comments
Hi all,
I need help solving the logistic growth model (an ODE) using Euler's Method in MATLAB.
The function is: (dy/dx) = r*y*(1-(y/K)) where r is the growth rate and K is the carrying capacity.
I have solved this out by hand but I am having a difficult time implementing it as a function.
I'm meant to write a function with two inputs (a vector time, t, and an initial y, y0) and this function is meant to output a vector of solutions to the ode for each time t and plot the results.
I know there is mean to be some h as a time step to evaluate a new tangent line at the function and the smaller that step is, the more accurate the answer is, but I'm having a hard time writing the code.
Can anyone help?
8 Comments
James Tursa
on 20 Sep 2016
What code have you written so far? Do you know what Euler's Method is? Do you know how to write a loop? Do you know how to plot?
Star Strider
on 20 Sep 2016
John D'Errico
on 20 Sep 2016
So make an effort! You should know how Euler's method works. Surely it has been discussed.
Erin W
on 22 Sep 2016
Erin W
on 22 Sep 2016
Star Strider
on 22 Sep 2016
How were you told to implement the Euler method?
Erin W
on 22 Sep 2016
Star Strider
on 22 Sep 2016
I should have been clearer. Sorry.
What algorithm for the Euler method were you told to use, or was discussed in class?
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!