VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY PROJECT REPORT Plot the trajectory of electron in static electromagnetic field Instructor: Pro
Trang 1
VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY
PROJECT REPORT Plot the trajectory of electron in static electromagnetic field
Instructor: Prof Huynh Quang Linh
Course code: PH1003
Class: CCO1 Group: 10 Members:
Ho Chi Minh City, November 2021
Trang 2
I1 000400900009) 07 1
PM 9è 3
3 MATLAB Code and ExplanafiOII - Ăn nh nn 5
4 Results and CISCUSSIOI - 5 5 1 9 90 9.0 họ Thi n 8
5 Conclusion n5 14
;585)95)0105S0777 14
Trang 31 Introduction
Electromagnetic theory is concerned with the study of charges at rest and
in motion Electromagnetic principles are fundamental to the study of electrical engineering It is also required for the understanding, analysis and design of various electrical , electromechanical and electronic systems Electromagnetic theory can be thought of as generalization of circuit theory Electromagnetic theory deals directly with the Ielectric and magnetic field vectors where as circuit theory deals with the voltages and currents Voltages and currents are integrated effects of electric and magnetic fields respectively
The Electromagnetic field problems involve three space variables along with the time variable and hence the solution tends to become correspondingly complex
A charged particle of mass m and charge q will experience a force acting
upon it in an electric field # Also, the charged particle will experience a
magnetic force acting upon it when moving with a velocity v in a magnetic
field B
The equation of the electron when its moves in static electromagnetic field
is expressed by the Lorentz force:
E =E+E =q# +qux#Ẻ With the initial position and velocity, we can determine the kinetic motion equations of electron x (t), y (t) and z (t) After that, we can determine the acceleration of the electron
Subsequently, eliminating t from mentioned motion equations, we can
derive f (x, y, z) = const, which is the orbital equation of electron
If the charged particle is stationary ( v = 0), the force depends only of the electric field The direction of the electric force is in the same direction as the electric field if q > 0 and the electric force is in the opposite direction to the electric field if q <0
When a charged particle is moving only in a magnetic field, the direction
1
Trang 4of the magnetic force is at right angles to both the direction of motion and the direction of the magnetic field as given by the right hand palm rule
+q
Vv
J
out of page
palm face
positive chargeina
fingers magnetic field
‘
‘vy, (+q) thumb
B fingers
= motion of a
( 4) negative charge in
= a magnetic field
F palm face This project requires students to use MATLAB to calculate and simulation
of the trajectory of a particle in electric and magnetic field (electromagnetic field).
Trang 52 Theory
Consider a particle of charge q coulombs and mass m kilograms subjected
to an electric field
In newtons per coulomb and a magnetic field
B (0.0.Bz) ~ B = Bf
The equation of the electron when its moves in static electromagnetic field
is expressed by the Lorentz force:
F =K+ER=qE +quxB
E =mữ
E =q( +t xB)
=> md =q(E-+& x B)
With & is the acceleration vector Expressing by component in the Cartesian coordinates reference, we can obtain following differential equations:
m( a,0101 + a,ETI + a;kl ) = q[Ez kÌ + (u„TTI+ u,ETT + u;kl ) x B; kỉ]
m( a„LTTI + aETI+ azkl ) = gE, ke + q(u,ET] + u,ETI + u;kl) x B„ kì
ma, = qBz Uy
=> { may = —qBz Uy
ma, = qEz
_ qBz
=
qBz
=> JO = — = 30
E,
w= q1z
Projection in the direction of Ox
Differential equation
ney Bz,
x”(Ð = a ()
Trang 6Projection in the Oy direction
Differential equation
qBz ,
" t =—'“ x t
y'@== —xŒ
Projection in the Oz direction
Differential equation
2"(t) =
With
x(0) = Xp
y(0) = Yo
z(0) = Zọ
x/(0) = Uzo
z'(0) = Vz
These are coupled second-order ordinary differential equations that can be solved by either analytical or numerical methods
Numerically, as done in this demonstration, the solution needs initial
conditions for the velocity and the position, given by
3 (Xo.¥0.Zo) > BH = Xo + yj + Zoke
By (Vx0.Vy9sVz9) —> Ups = UyoFTT+ vy OID + vzolel
Trang 73 MATLAB Code and Explanation
% Motion of a electron in uniform cross B and E fields clear; cle; clf;
syms x(t) y(t) 2(0);
syms k kl k2 vx0 vy0 vz0 x0 y0 z0;
format short;
coh
% SYMBOLIC OPERATION
coh
Dx = diff(x,t);
Dy = dif(y,0;
Dz = diff(z.t);
% \k1 = q*B/m and k2 = q*E/m
% ODE function
odel = diff(x,t,2) == k1*diff(y.t);
ode2 = diff(y,t,2) == -k1*diff(x,t);
ode3 = diff(z,t2) == k2;
Eqn = [ode1, ode2, ode3];
Cond = [Dx(0) = vx0; Dy(0) == vy0; Dz(0) == vz0;
x(0) == x0; y(0) == yO; z(0) == 70];
S = dsolve(Eqn Cond);
x_func = collect(simplify(S.x));
y_func = collect(simplify(S.y));
z_func = collect(simplify(S.z));
vx_func = collect(simplify(diff(S.x,0)));
vy_func = collect(simplify(diff(S-y,t));
vz_func = collect(simplify(diff(S.z,t)));
ax_func = collect(simplify(diff(S.x.t/2)));
ay_func = collect(simplify(diff(S -y,t,2)));
az_func = collect(simplify(diff(S.z t.2)));
coh
% OUTPUT FUNCTION
coh
% Motion function
dispCMotion function on x-direction: x='); disp(x_func); dispCMotion function on y-direction: y='); disp(y_func); disp('‘Motion function on z-direction: z="); disp(z_func); disp('000000000000000000000000000000000000000000000');
% Velocity function
disp('Velocity function on x-direction: vx ='); disp(vx_func); disp('Velocity function on y-direction: vy ='); disp(vy_func); disp('Velocity function on z-direction: vz ='); disp(vz_func); disp('000000000000000000000000000000000000000000000');
% Acceleration function
disp('‘Acceleration function on x-direction: ax ='); disp(ax_func); disp('‘Acceleration function on x-direction: ay ='); disp(ay_func); disp('‘Acceleration function on x-direction: az ='); disp(az_func); disp('000000000000000000000000000000000000000000000');
% Note
disp('with kl = q*B/m');
disp('with k2 = q*E/m');
Trang 8% DISPLAY RECOMMENDED INPUT PARAMETERS
%
disp('000000000000000000000000000000000000000000000');
disp(‘Recommended parameters for you to enter/input')
disp(‘Recommended initial position of electron: [0 0 0] ');
disp('‘Recommended initial position of electron [2 3 -5]');
disp(Recommended static magnetic field parallel to z-axis: 2e-11');
disp(‘Recommended static electric field parallel to z-axis: 5e-12');
coh
% INPUT PARAMETERS
%
dispC ); dispC 3; disp( 3; dispC );
% Enter initial position and velocity of electron
r0 = input('Enter the initial position of electron [x0 yO z0] (m) - );
vO = input('Enter the initial velocity of electron [vx0 vy0 vz0] (m/s) - ');
% Enter magnitude of uniform B and E fields
B = input(‘Enter static magnetic field parallel to z-axis [0 0 B] (T) - ');
E = input('Enter static electric field parallel to z-axis [0 0 E] (V/m) - ');
% Parameter of electron
m = 9.10939e-31;
q = 1.602177e-19;
k11= q*B/m;
k22= q*E/m;
disp(''); disp(''); disp(''); disp( ');
%
% CALCULATE THE ELECTROMAGNETIC FORCE ACTING ON THE ELECTRON
%
Fx=subs(m*ax_func,[x0,y0,z0,vx0,vy0,vz0,k1 ,k2],[r0(1).r0(2),r0(3),v0(1),v0(2),v0(3
)k11,k22));
Fy=subs(m*ay_ func,[x0,y0,z0,vx0,vy0,vz0,k1 ,k2],[r0(1).r0(2),r0(3),v0(1),v0(2),v0(3
)k11,k22));
Fz=subs(m#az_func,[x0,y0,z0,vx0,vy0,vz0,k1 ,k2],[r0(1).r0(2),r0(3),v0(1).v0(2).v0(3
)k11,k22));
disp('Force acting on the electron on x-direction: Fx='); pretty(Fx);
disp('Force acting on the electron on y-direction: Fy='); pretty(Fy);
disp('Force acting on the electron on z-direction: Fz='); disp(double(Fz));
dispC 3; disp(''); disp(''); dispC );
Œ%
% OUTPUT FUNCTION
coh ‘0
h1=subs(S.x,[x0,y0.z0,vx0,vy0,vz0,k1,k2] [r0(1) r0(2) r0(3).v0(1),v0(2).v0(3),k11,
k22)):
h2=subs(S.y,[x0,y0z0,vx0,vy0,vz0,k1,k2][r0(1).r0(2).r0(3),v0(1),v0(2),v0(3),k11,
k22)):
h3=subs(S.z,[x0,y0z0,vx0,vy0,vz0,k1,k2][r0(1) r0(2).r0(3) ,v0(1),v0(2),v0(3),k11,
k22)):
Trang 9dispCMotion function on x-direction: x='); pretty(h1);
dispCMotion function on y-direction: y='); pretty(h2);
disp('Motion function on z-direction: z="); pretty(h3);
disp('0000000000000000000000000000000000000000000000000000000000000000000000000');
% Velocity function
disp('Velocity function on x-direction: vx ='); pretty(diff(h1 ,t));
disp('Velocity function on y-direction: vy ='); pretty(diff(h2,t));
disp('Velocity function on z-direction: vz ='); pretty(diff(h3 ,t));
disp('0000000000000000000000000000000000000000000000000000000000000000000000000');
% Acceleration function
disp('‘Acceleration function on x-direction: ax ='); pretty(diff(h1 ,t,2));
disp('‘Acceleration function on x-direction: ay ='); pretty(diff(h2 ,t,2));
disp('‘Acceleration function on x-direction: az ='); pretty(diff(h3 ,t,2));
%
% PLOT THE TRAJECTORY OF ELECTRON
%
figure(1)
XMax=5 ;XMin= -XMax;
YMax = XMax ; YMin = -YMax;
ZMax = 20 ; ZMin = -20;
fplot3(h1 h2,h3,[0 50],','LineWidth' ,1);
grid on
axis equal
box on
axis([X Min, XMax, YMin, YMax, ZMin, ZMax]);
xlabel('x [m]');
ylabel('y [m]');
zlabel('z [m]');
set(gca,'fontsize',10);
Trang 104 Results and discussion
15 |
y [m] lở 5 x [m]
Trang 11y
Trang 12
Motion function on x-direction: x=
x0 + (vv0 - vy0*cos(kl*t) + vxz0*sin(kl*t))/kl
Motion function on y-direction: y=
v0 + (vx0*cos(kl*t) - vx0 + vy0*sin(kl*t))/kl
Motion function on z-direction: z=
(k2*t^2)/2 + vz0*t + z0
[o ololololololololololoiololololololololololololololoiolololololololololololoioloioioloiol
Velocity function on x-direction: vx =
cos (k1*t)*vx0 + vy0*sin(kl*t)
Velocity function on y-direction: vy
(-sin(k1*t))*vx0 + vy0*cos(k1*t)
Velocity function on z-direction: vz =
vz0 + k2*t
©GØØØÒOOOOOOOOOODOOOOOOOOOOOOOOOOOOOOOOOODOOOOO
Acceleration function on x-direction: ax =
(T-kl*sin (kl*t))*vx0 + kl*vy0*cos (kl*t)
Acceleration function on x-direction: ay =
(-k1*cos (k1*t))*vx0 - ki*vy0*sin(k1*t)
Acceleration function on x-direction: az =
k2
©OOOOOOOOOOOOOOOCOCOOOOOOOOOOOOOOOOCOCOOOOOOOOO
with kl = q*B/m
with k2 = q*E/m
000000000000000000000000000000000000000000000
Recommended prameters for you to enter/input
Recommended initial position of electron: [0 0 0]
Recommended initial position of electron [2 3 -5]
Recommended static magnetic field parallel to z-axis: 2e-11
Recommended static electric field parallel to z-axis: 5e-12
Enter the initial position of electron [x0 y0 z0] (m) - [0 0 0] Enter the initial velocity of electron [vx0 vy0 vz0] (m/s) - [2 3 -5]
Enter static magnetic field parallel to z-axis [0 0 B] (Tesla) - 2e-11 Enter static electric field parallel to z-axis [0 0 E] (V/m) - 5e-12
Force acting on the electron on x-direction: Fx=
/ 7921017477769179 t \
CoS] sso esse ess esas | 61790380198481666882465389812213
\ 2251799813685248 /
ie 64277521770359611021 67848 36936465041 0088811975131171341 205504
10
Trang 13Force acting on the electron on x-direction: Fx=
/ 792101 7477769179 -t: \
COS!) | aS | 61790380198481666882465389812213
\ 2251799813685248 /
6427752177035961102167848369364650410088811975131171341205504
/ 7921017477769179 t \
sin| -— - | 20596793399493888960821796604071
\ 2251799813685248 /
3213876088517980551083924184682325205044405987565585670602752 Force acting on the electron on y-direction: Fy=
/ 7921017477769179 t \
Gog] ==—=========ằ=-=~= | 20596793399493888960821796604071
\ 2251799813685248 /
3213876088517980551083924184682325205044405987565585670602752 / 7921017477769179 t \
sin| - | 61790380198481666882465389812213
\_ 2251799813685248 /
6427752177035961102167848369364650410088811975131171341205504 Force acting on the electron on z-direction: Fz=
8.0109e-31
Motion function on x-direction: x=
/ 7921017477769179 t \
sin] - | 4503599627370496
\ 2251799813685248 /
7921017477769179
/ 7921017477769179 t \
Cos| —-—-—-—-—~—-—~ —~ | 2251799813685248
\ 2251799813685248 / 2251799813685248
2640339159256393 2640339159256393 Motion function on y-direction: y=
/ T921017477769179 t \
gøgÌ -—— | 4503599627370496
\ 2251799813685248 /
7921017477769179
II
Trang 14Motion function on x-direction: x=
/ 7921017477769179 t \
sig) ——=———===—r=-==== | 4503599627370496
\ 2251799813685248 /
7921017477769179
/ 7921017477769179 t \
Cas] ==—==========—m=——=— | 2251799813685248
\ 2251799813685248 / 2251799813685248
Se By easrenesaieeesosenenastietee
2640339159256393 2640339159256393 Motion function on y-direction: y=
/ 7921017477769179 t \
cos| - | 4503599627370496
\ 2251799813685248 /
7921017477769179
/ 7921017477769179 t \
\ 2251799813685248 / 4503599627370496
# "“ ˆ _, a
2640339159256393 7921017477769179
Motion function on z-direction: z=
Z
7921017477769179 t
18014398509481984
09909000000000000000000000000000000000000000000000000000000000000099000000
Velocity function on x-direction: vx =
/ 7921017477769179 t \ / 7921017477769179 t \
CG8| ceases sess | 2+ gin) -— - | 3
\ 2251799813685248 / \ 2251799813685248 /
Velocity function on y-direction: vy =
/ 7921017477769179 t \ / 7921017477769179 t \
gØB] ===—==—=>~—=—==—==~ l 3= g7ml “—>>====>~===~—= | 2
\ 2251799813685248 / \ 2251799813685248 /
Velocity function on z-direction: vz =
7921017477769179 t
9007199254740992
0090900000000000000000000000000000000000000000000000000000000000000000000
Acceleration function on x-direction: ax =
/ 7921017477769179 t \
gös| m>—-~ -~=—-z=—~ | 23763052433307537
Se \X_ 2251799813685248 /
12
Trang 15Velocity function on x-direction: vx =
/ 7921017477769179 t \ / 7921017477769179 t \
Cos| =-~~-~-~~ —~———~—— | 2 + sin| -~ ~-~—~ | 3
\ 2251799813685248 / \ 2251799813685248 /
Velocity function on y-direction: vy =
/ 7921017477769179 t \ / 7921017477769179 t \
COS sno sss SEs Sse == [ So= SQn) saeesssssssrsS==s= 12
\ 2251799813685248 / \ 2251799813685248 /
Velocity function on z-direction: vz =
7921017477769179 t
9007199254740992
2000000000000000000000000000000000000000000000000000000000000000000 Acceleration function on x-direction: ax =
/ 7921017477769179 t \
cos| - | 23763052433307537
\_ 2251799813685248 /
2251799813685248
/ 7921017477769179 t \
sin| - | 7921017477769179
1125899906842624 Acceleration function on x-direction: ay =
/ 7921017477769179 t \
608] ss ocse tor ssos SoS | 23763052433307537
\ 2251799813685248 /
2251799813685248
/ 7921017477769179 t \
sin| - | 7921017477769179
\ 2251799813685248 /
1125899906842624
Acceleration function on x-direction: az =
/ 7921017477769179 t \
ces) =H oss seas | 23763052433307537
\ 2251799813685248 /
2251799813685248
/ 7921017477769179 t \
sin| - | 7921017477769179
\ 2251799813685248 /
1125899906842624
Sk >>
13