x = zeros(9,1);
y = zeros(9,1);

data = load('x25cm.txt'); t = data(:,1); I = data(:,2);
x(1)=0.25; y(1)=mean(I); e(1)=std(I);

data = load('x30cm.txt'); t = data(:,1); I = data(:,2);
x(2)=0.30; y(2) = mean(I); e(2)=std(I);

data = load('x35cm.txt'); t = data(:,1); I = data(:,2);
x(3)=0.35; y(3) = mean(I); e(3)=std(I);

data = load('x40cm.txt'); t = data(:,1); I = data(:,2);
x(4)=0.40; y(4) = mean(I); e(4)=std(I);

data = load('x45cm.txt'); t = data(:,1); I = data(:,2);
x(5)=0.45; y(5) = mean(I); e(5)=std(I);

data = load('x50cm.txt'); t = data(:,1); I = data(:,2);
x(6)=0.50; y(6) = mean(I); e(6)=std(I); e(6) = 0.0465;

data = load('x75cm.txt'); t = data(:,1); I = data(:,2);
x(7)=0.75; y(7) = mean(I); e(7)=std(I);

data = load('x100cm.txt'); t = data(:,1); I = data(:,2);
x(8)=1.00; y(8) = mean(I); e(8)=std(I);

data = load('x115cm.txt'); t = data(:,1); I = data(:,2);
x(9)=1.25; y(9) = mean(I); e(9)=std(I);
w = 1./e.^2;

%X = log(x);
%Y = log(y);
%p = polyfit(X,Y,1);
%xi = -1.5:0.01:0.5;
%yi = p(1)*xi + p(2);
%fprintf('Fiting results for I = k/x^n\n',2);
%fprintf('Expected value of n = %f\n',2);
%fprintf('Measured value of n = %f\n',-p(1));
%fprintf('Percentage error    = %f%%\n',100*abs(-p(1)-2)/2);
%plot(X,Y,'*')
%hold on
%plot(xi,yi,'r-');
%grid on


