Predicting Population Growth in 1900 with Stewart 275/05

Click For Summary
SUMMARY

This discussion focuses on predicting population growth in the year 1900 using MATLAB with the Stewart 275/05 dataset. The user employs the polyfit function for linear fitting of logarithmic population data, contrasting with a quadratic approach. Key MATLAB commands include delete, diary, clear, and plot. The final model predicts the population by fitting exponential curves to the data points from 728 to 2517 over the years.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of polynomial fitting using polyfit
  • Knowledge of logarithmic transformations in data analysis
  • Basic concepts of exponential growth modeling
NEXT STEPS
  • Explore advanced MATLAB plotting techniques for better data visualization
  • Learn about nonlinear regression methods in MATLAB
  • Study the implications of population growth models in demographic studies
  • Investigate the differences between linear and quadratic fitting in data analysis
USEFUL FOR

Data analysts, statisticians, and researchers interested in demographic modeling and MATLAB programming for predictive analytics.

xpack
Messages
37
Reaction score
0
muhaag.jpg


I have this
Code:
delete s275x05.txt; diary s275x05.txt
clear; clc; close all; echo on
%
% Stewart 275/05
%
year=[0:1]; % n+1 = year + 50
pop=[728 906];
p=polyfit(year,log(pop),2)
plot(year,pop,'o','MarkerFaceColor','r')
hold on
x=[0:0.01:6];
y=exp(polyval(p,x));
plot(x,y)
hold on
%part a
%popluation at year 1900
x1900=3
%
echo off; diary off

What I am stuck at is how do I say I want the y value when x = 3?
 
Physics news on Phys.org
i just got finished with that problem, and mine is a little bit different than yours. for instance, on the polyfit lines, you don't need to make them quadratic, i just made mine linear. also, i didn't do parts a b and c because on the website (http://calclab.math.tamu.edu/~dmanuel/calclab/m151/Fall/2009c_matlab8.html) all it says is to use exponential fitting on the pairs of points. so it's a lot simpler than you're making it out to be. all in all, i got this:

'delete s275x05.txt; diary s275x05.txt
clear; clc; close all; echo on

year=[0:1];
pop=[728 906];
p=polyfit(year,log(pop),1)
plot(year,pop,'o','MarkerFaceColor','r')
hold on
x=[0:0.01:6];
y=exp(polyval(p,x));
plot(x,y)
hold off

year=[2:3];
pop=[1171 1608]
p=polyfit(year,log(pop),1)
plot(year,pop,'o','MarkerFaceColor','r')
hold on
x=[0:0.01:6];
y=exp(polyval(p,x));
plot(x,y)
hold off

year=[3:4];
pop=[1608 2517];
p=polyfit(year,log(pop),1)
plot(year,pop,'o','MarkerFaceColor','r')
hold on
x=[0:0.01:6];
y=exp(polyval(p,x));
plot(x,y)
hold off

year=[0:4];
pop=[728 906 1171 1608 2517];
p=polyfit(year,log(pop),1)
plot(year,pop,'o','MarkerFaceColor','r')
hold on
x=[0:0.01:6];
y=exp(polyval(p,x));
plot(x,y)
hold off

echo off; diary off'
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K