trajectory of an electron in an electron beam evaporator

1 次查看(过去 30 天)
I already made a code, but I want the path to be circular, please help
clc; clear all
M = 100 ;
t = linspace(0,20,M) ;
m=9.1e-31 ;
q=-1.6e-19 ;
P = zeros(M,3) ;
V = zeros(M,3) ;
p = rand(1,3) ;
v = rand(1,3) ;
P(1,:) = p ;
V(1,:) = v ;
c = rand ;
E=[0 0 c] ;
d = rand ;
B=[0 0 d] ;
for i = 2:M
f=q*E+q*cross(v,B) ;
a=f/m ;
v = v+a*t(i) ;
p = p+v*t(i) ;
P(i,:) = p ;
V(i,:) = v ;
end
plot3(P(:,1),P(:,2),P(:,3));
axis equal
xlabel('x'); ylabel('y'); zlabel('z');
grid on
set(gca,'fontsize',14);

回答(1 个)

Swapnil Tatiya
Swapnil Tatiya 2023-7-13
The electron shall not go in a circle when both E field and B field are applied simultaneously,so I've modified your code such that there's just B field so that you get a trajectory as you desired.
M = 100;
t = linspace(0,20,M) ;
m=9.1e-31 ;
q=-1.6e-19 ;
P = zeros(length(t),3) ;
V = zeros(length(t),3) ;
V(1,:) = [0 rand(1) 0] ;
d = rand(1) ;
B=[0 0 10^-12] ;
for i = 2:length(t)
f=q.*(cross(V(i-1,:),B));
a=f/m;
V(i,:) = V(i-1,:)+a*(t(i)-t(i-1)) ;
P(i,:) = P(i-1,:)+V(i-1,:)*(t(i)-t(i-1)) ;
end
plot(P(:,1),P(:,2))
grid on
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by