Question
Plese solve question 2 first part only using this code % Lorenz Force a MATLAB code to compute orbit of a charged % particle in
Plese solve question 2 first part only using this code
% Lorenz Force a MATLAB code to compute orbit of a charged % particle in an electromagnetic field clear; help LorenzForce24OCT2017; ro = input('Enter initial radial distance from the x-axis: '); vo = input('Enter initial velocity in the x-direction: '); r = [ro 0 0]; v = [vo 0 0]; qE_m = 1 ; qB_m =1; B = [0 1 0]; E = [1 0 0]; t = 0; nstep = input ('Enter number of steps: '); tau = input (' Enter time step: '); NM = menu ('Method:',' Euler', 'Euler-Cromer');
for istep = 1:nstep xplot(istep) = r(1); yplot(istep) = r(2); zplot(istep) = r(3); tplot(istep) = t; if (NM == 1) % Euler Method a = qE_m.*E +qB_m.*cross(v,B); r = r + tau*v; v = v + tau*a; t = t + tau; elseif (NM == 2) % Euler-Cromer Method a = qE_m*E +qB_m*cross(v,B); v = v + tau*a; r = r + tau*v; t = t + tau; end end plot(xplot,zplot) pause plot3(xplot, yplot, zplot)
PHYS 5252 (COMPUTATIONAL PHYSICS) HOMEWORK 3 1- Modify the ORBIT.m MATLAB code to use Verlet method. Compare the performance with Euler, Euler-Cromer, and mid-point methods 2- The Lorentz force on a charged particle in a given electric and magnetic field is given by: F q(E +v X B) Write a MATLAB code using the (Euler, Euler-Cromer, mid-point, and Verlet) methods to simulate the motion of an electron in uniform, perpendicular electric, and magnetic fields. Show that the motion is helical in form, with a pitch that depends on the initial particle velocity and with a drift velocity: Show derivation of the drift velocity. The Wilberforce pendulum (American Journal of Physics, 59, 32-38 (1991), is illustrated in Figure 3. The pendulum has two modes of oscillation: vertical and torsional motion. The Lagrangian of the system is 3- dz 2 Idt of the bob, k and are the longitudinal and where m and l are mass and rotational inertia torsional spring constants, and is the coupling constant between the modes. Typical values ( m=0.5 kg, l=10 kg.m, k=5 N/m, = 103 Nm, and 102 N. Find the equation of motion and write a program to compare z(t) and (t) using rk4 show that when the longitudinal frequency, f,- equals 7, the motion periodically alternates between being purely longitudinal and purely torsional. PHYS 5252 (COMPUTATIONAL PHYSICS) HOMEWORK 3 1- Modify the ORBIT.m MATLAB code to use Verlet method. Compare the performance with Euler, Euler-Cromer, and mid-point methods 2- The Lorentz force on a charged particle in a given electric and magnetic field is given by: F q(E +v X B) Write a MATLAB code using the (Euler, Euler-Cromer, mid-point, and Verlet) methods to simulate the motion of an electron in uniform, perpendicular electric, and magnetic fields. Show that the motion is helical in form, with a pitch that depends on the initial particle velocity and with a drift velocity: Show derivation of the drift velocity. The Wilberforce pendulum (American Journal of Physics, 59, 32-38 (1991), is illustrated in Figure 3. The pendulum has two modes of oscillation: vertical and torsional motion. The Lagrangian of the system is 3- dz 2 Idt of the bob, k and are the longitudinal and where m and l are mass and rotational inertia torsional spring constants, and is the coupling constant between the modes. Typical values ( m=0.5 kg, l=10 kg.m, k=5 N/m, = 103 Nm, and 102 N. Find the equation of motion and write a program to compare z(t) and (t) using rk4 show that when the longitudinal frequency, f,- equals 7, the motion periodically alternates between being purely longitudinal and purely torsionalStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started