using euler method for population growth

4 views (last 30 days)
Kelsey Pettrone
Kelsey Pettrone on 21 Sep 2020
Answered: Alan Stevens on 21 Sep 2020
I dont know how i would write this formula using the euler method
dp/dt=G(Pmax-P(t))*p(t)
Plot the population as a function of time from t = 0 to t = 20 years
Use the following values for constants in the differential equation: o pmax = 10,000 o G = 0.00005
Use an initial condition of p = 800 when t=0
  2 Comments
Walter Roberson
Walter Roberson on 21 Sep 2020
Is P(t) different than p(t) ?
I recommend you look at ode45()
Reminder: MATLAB has no implied multiplication. All multiplication needs to be explicit with either .* or *
James Tursa
James Tursa on 21 Sep 2020
What have you done so far? What specific problems are you having with your code?

Sign in to comment.

Answers (1)

Alan Stevens
Alan Stevens on 21 Sep 2020
If you must use the simple Euler method you need to write the equation in the following form:
p(i+1) = p(i) + dt*G*(pmax - p(i))*p(i);
where dt is your chosen timestep size, and i loops from 2 to N, where N is 20/dt. You would first set p(1) = 800.

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!