MATLAB Rutherford scattering using MatLab

AI Thread Summary
The discussion revolves around a program simulating the angle distribution of particles scattered from a gold nucleus using MatLab. The user expresses doubts about the accuracy of their results and seeks feedback on their code. They are uncertain whether to vary both the initial speed and impact parameter in one program or to create separate programs for each variable, currently opting to only vary initial speed. The provided code outlines the simulation process, including calculations for particle movement and angle determination. The user welcomes any suggestions or insights to improve their simulation.
ShayanJ
Science Advisor
Insights Author
Messages
2,801
Reaction score
606
I'm writing a program for simulating the angle distribution of scattered particles from a gold nucleus but I doubt the results. I don't know...But it would be very good if someone check it and give some hints.
I also want to ask should I vary both initial speed and impact parameter in one program or I should write two different programs?
In this program I only vary the initial speed.
Here's the code:
Code:
clear
clc

m=4*1.67*10^(-27);
e=1.6*10^(-19);
q=2*e;
Q=79*e;
k=8.9875518*(10^9);

dt=.01;
t=[0:dt:20];
n=length(t);

da=5;
alpha=[0:da:360];
m=length(alpha);

flags=zeros(m);

y(1)=1;
x(1)=-100;
vy(1)=0;

for v0=0:100
	
	vx(1)=v0;
	
	for i=2:n-1
	
		x(i)=x(i-1)+vx(i-1)*dt;
		y(i)=y(i-1)+vy(i-1)*dt;
		
		rcs=(x(i-1)^2+y(i-1)^2)^(3/2);
		
		vx(i)=vx(i-1)+((k*q*Q*x(i-1))/(m*rcs))*dt;
		vy(i)=vy(i-1)+((k*q*Q*y(i-1))/(m*rcs))*dt;
		
	end
	
	temp=atan(y(n-1)/x(n-1));
	
	if(temp<0)
	
		temp=temp+2*Pi;
		
	end
	
	theta=temp;
	
	for j=1:m
	
		if (theta==alpha(j) | (theta>(alpha(j)-da) & theta<(alpha(j)+da)))
		
			flags(j)=flags(j)+1;
			
		end
		
	end
	
end

plot(flags,'o')
hold on
grid on

Any idea is welcome
Thanks
 
Physics news on Phys.org
I'm sorry you are not finding help at the moment. Is there any additional information you can share with us?
 

Similar threads

Back
Top