% Program: population.m
% Author:  Michael Goldwasser
% This is a solution for CSCI-145, asgn03

raw = load('population.txt');
plot(raw(:,1), raw(:,2), '.');    % plot actual data
hold on;

t = 1650:10:2000;
a = 1.97E8;
b = 0.7;
c = 1.5E26;
d = -0.03134;
Pt = a ./ (b + c .* exp(t .* d));
plot(t,Pt, 'r');                  % plot estimate function

title('Population of the United States of America');
xlabel('Year');
legend('US Population', 'estimate', 'Location', 'NorthWest');
hold off;
