load hw02.dat;
speed = 315.569 * (10.^crap(:,1));
dist = 0.00001 * (10.^crap(:,2));
[sps,idx] = sort(speed);
ds = dist(idx);
yy = polyfit(sps,ds,1);
zz = polyval(yy,sps);
plot(sps,ds,'ro',sps,zz,'g-')
stext(1e11,6.6e22,'Slope = Age of Universe = 1.413 x 10^{10} years = 14.13 billion years');
xlabel 'Speed (km/year)'
ylabel 'Distance (km)'
title 'Speed of Retreat vs. Distance to Various Distant Galaxies'
printsto -dpsc hw02-ans.graph.ps
diary
