y =   [15.4500 ;   
       15.6000 ;   
       15.6000 ;   
       15.7000 ;   
       15.1500 ;   
       15.0500 ;   
       15.3000 ;   
       15.3500 ;   
       14.8000 ;   
       14.9000 ;   
       14.9000 ;   
       14.7500 ;   
       14.3000 ;   
       14.4500 ;   
       14.4000 ;   
       14.5500 ;   
       14.1500 ;   
       14.0000 ;   
       14.3000 ;   
       13.9000 ;   
       13.8500 ;   
       13.8000 ;   
       13.1500 ;   
       12.1000 ;   
       11.6500];    

x =   [0.0981;
       0.2211;
       0.2460;
       0.2730;
       0.3372;
       0.4643;
       0.5442;
       0.6324;
       0.6577;
       0.6978;
       0.7252;
       0.7262;
       0.7988;
       0.8228;
       0.8741;
       0.9241;
       1.0144;
       1.0661;
       1.0940;
       1.1166;
       1.1294;
       1.2240;
       1.5043;
       1.8182;
       2.1038];

n(:,2) = x;
n(:,1)=ones(size(x));
c=n\y;

slope = c(2)
yintercept = c(1)

sp='The Slope is ';
s=num2str(slope);
st=[sp,s];

si='The Y intercept is ';
i=num2str(yintercept);
sti=[si,i];


xp= [min(x):(max(x)-min(x))/100 :max(x)]';
yp= c(2)*xp+c(1);

figure;
Hold on
plot (x,y,'r*');
plot (xp,yp,'b-');
legend('Data','Fitted Line',st,sti,3)
t1='Example demonstrating linear regression of data';
t3='D.W. Donovan -';
t0=' \newline ';
t=[t1,t0,t3,date];
title (t)
xlabel('x in unitless numbers')
ylabel('f(x) in unitless numbers')
