population growth for this problem matlab

조회 수: 60 (최근 30일)
marie
marie 2013년 2월 20일
편집: per isakson 2017년 8월 22일
The population of a certain country is 50 million and is expected to double in 20 years. Calculate the population 5, 10, and 15 years from now by defining a vector t with 3 elements and using element-by-element calculations. Population growth can be modeled by the equation p=p02^t/d where P is the population at time t, 0 P is the population at t = 0, and d is the doubling time.
so the equation is p=p02^t/d
I have d=ln(2)/20=0.035 then ln(2)/0.035
p=50000000*exp(d/t)
is that righ?
  댓글 수: 4
Youssef  Khmou
Youssef Khmou 2013년 2월 21일
편집: Youssef Khmou 2013년 2월 21일
the population is 50 e+6 now and expected to double in 20 years, so 100 millions next 20 years ? "double" like x2 ? anyway it means increasing but your last equation is decreasing, at least change the last eq to : exp(t/d) .
Subrata Paul
Subrata Paul 2017년 8월 22일
편집: per isakson 2017년 8월 22일
Try this...
%Taking the inputs
p0 = input('Enter the population at time(0): ');
d = input('Enter time in which population will be double: ');
%Have to calculate at 5,10,15 years
t = [5 10 15];
l = length(t);
%Population
p = ones(1,3)
for i = 1:l
temp = pow2( t(i) / d);
x(i) = floor( p0 * temp);
end
%Output
'The populations at 5,10 and 15 years are gradulally '
x
%Drawing graph
plot(t,x,'p-b');
xlabel('Years(t)'); ylabel('Population');
title('Population at different years');

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

답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by