trajectory of an electron in an electron beam evaporator

조회 수: 3 (최근 30일)
Ingrid Morales Flores
Ingrid Morales Flores 2023년 6월 18일
답변: Swapnil Tatiya 2023년 7월 13일
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