MATLAB Answers

population growth for this problem matlab

202 views (last 30 days)
marie on 20 Feb 2013
Edited: per isakson on 22 Aug 2017
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
is that righ?
Subrata Paul
Subrata Paul on 22 Aug 2017
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);
p = ones(1,3)
for i = 1:l
temp = pow2( t(i) / d);
x(i) = floor( p0 * temp);
'The populations at 5,10 and 15 years are gradulally '
%Drawing graph
xlabel('Years(t)'); ylabel('Population');
title('Population at different years');

Sign in to comment.

Answers (0)


Community Treasure Hunt

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

Start Hunting!