using euler method for population growth

조회 수: 4 (최근 30일)
Kelsey Pettrone
Kelsey Pettrone 2020년 9월 21일
답변: Alan Stevens 2020년 9월 21일
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
Walter Roberson
Walter Roberson 2020년 9월 21일
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 2020년 9월 21일
What have you done so far? What specific problems are you having with your code?

댓글을 달려면 로그인하십시오.

답변 (1개)

Alan Stevens
Alan Stevens 2020년 9월 21일
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.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by