% Calculate the counting rate as a function of angle for some

% given angular function g(phi,theta)



theta = linspace(0.1,pi,1000);

dtheta = theta(2)-theta(1);

rutherford_dcs = sin(theta/2).^(-4);



phi = linspace(0.2,pi-0.2);



N = length(phi);

C = zeros(1,N); % Counting rate

for i = 1:length(phi)

    arf = g(theta,phi(i)); % angular response function

    C(i) = dtheta*sum(arf.*rutherford_dcs); % Computer integration

end



plot(180/pi*phi,C,'linewidth',2);

ylim([0 10]);

xlabel('Scattering angle, \phi');

ylabel('Counting rate');

title('Expected counting rate curve, as given by a triangular angular response function');

grid on;

hold on;

dcs_for_comparison = sin(phi/2).^(-4);

plot(180/pi*phi,dcs_for_comparison,'r-.');