%Lesson 4 - Math 151 
%this is for Maona Loa CO2data
%annual averages 1970-1990
%first read in data from a file
%   load b:co2dat.sh
%then read in a command file that is
%this file of commands for MATLAB
%by first telling MATLAB to use the b: drive
%   !b:
%then telling it to run lesson4
%   lesson4
%where lesson4.m is a file on your 
%floppy in the b: drive
who,pause
a=co2dat(:,1),pause
b=co2dat(:,2),pause
!c:
plot(a,b,'+w')
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 2100'),pause
polyval(c,2100),pause
disp('when is co2 level = zero?'),pause
roots(c),pause

