%co2projection - Math 151 
%this is for Maona Loa CO2data
%annual averages 1970-1990
%first read in data from a file
%   load co2datyearly.txt
%then read in this file of commands for MATLAB
who,pause
a=co2datyearly(:,1),pause
b=co2datyearly(:,2),pause
plot(a,b,'+')
title('co2 vs year'),pause
c=polyfit(a,b,1),pause
m=[min(a) max(a)],pause
x=polyval(c,m),pause
plot(a,b,'+',m,x),pause
corrcoef(a,b),pause
disp('predict co2 level in 2000'),pause
polyval(c,2000),pause
disp('predict co2 level in 2010'),pause
polyval(c,2010),pause
disp('predict co2 level in 2100'),pause
polyval(c,2100),pause
disp('when is co2 level = zero?'),pause
roots(c),pause

