% The errors here are given by Connor's formula

data = [ 672 2070 300;

        1216  318 132;

        1578  180 80.9];



%errorbar(data(:,1),data(:,2),data(:,3),'o');



T = 900; % measurement time in seconds



lin_energy = 5.486/1572*data(:,1);

errorbar(lin_energy,1/T*data(:,2),1/T*data(:,3),'o');

fs = 15;

xlabel('Incident kinetic energy (MeV)','fontsize',fs);

ylabel('Rate of scattering (cps)','fontsize',fs);

title('Energy dependence of the \alpha-particle scattering rate (at 20^\circ)','fontsize',fs);



function_invEsq = @(x,a) a(1)*x.^(-2);

a0 = [5.486^2*data(3,2)];

dYda = {@(x,a) 1}; sgn = 0;



newvar = data(:,3).^2 + data(:,2) + (2*data(:,2)*5.67).^2*(pi/180)^2;

newsig = sqrt(newvar);



[a,aerr,chisq,yfit,corr] = levmar(lin_energy,data(:,2),newsig,...

    function_invEsq,a0,dYda,sgn);

hold on;

x = linspace(2,6);

y = function_invEsq(x,a);

plot(x,1/T*y,'r','linewidth',2);



legend('Measured data', 'E^{-2} fit (\chi^2/dof = 1.45)');

text(3-0.5,2,'Fit yields: R = b{\cdot}E^{-2}, b = (7.4\pm1.6)\times10^{-3} cps\cdotMeV^2','fontsize',fs);

