P2: Given Scripts/Functions

 

GetSunSpotData

function z = GetSunSpotData
% for y = 1875:2001 and j=1:12
%   z(12*(y-1875)+j) = amount of sunspot activity during month j
%   of year y.
fid = fopen('SunSpotArea.txt');
n = 12*(2001-1875+1);
z = zeros(n,1);
for k=1:n
   x = fscanf(fid,'%g',1);
   y = fscanf(fid,'%g',1);
   z(k) = fscanf(fid,'%g',1);
end

Download SunSpotArea.txt .