- #1
- 2,810
- 604
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:
Any idea is welcome
Thanks
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