Introductory Programming Fall 2006 Here's a framework for the particle in a magnetic field problem. I've put everything in a single file and changed the names of the functions. magpart calls ode45, which calls part. I've removed the bodies of the functions and left the comments function magpart(te) % te is the duration of the time range % initial conditions % call ode45 % plot the results end function dXdt = part(t, X) % t is the current time; X contains the position and velocity % vectors; evaluate the derivative dXdt end function A = acceleration(t, P, V) % t is the current time, P is the position of the particle in % 3-space, V is the velocity of the particle. Return the % total acceleration of the particle. end function F = mag_force(t, P, V) % t is the current time, P is a position in 3-space % V is the current velocity; compute and return the % resulting magnetic force end function B = mag_field(t, P) % t is the current time, P is a position in 3-space % compute and return B, the magnetic field at the given position end function F = drag_force(V) % V is the current velocity; return the resulting drag force end If you finish the questions in notes16.txt, try this variation. The magnetic field around an infinite straight wire is mu0 I B = ------- L x R 2 pi r^2 where mu0 is the constant 4 * pi * 10^-7 (in T m / A) I is the current in Amps R is the vector from the nearest point on the wire to P r is the magnitude of R L is a unit vector pointing in the direction of current flow Modify mag_field so it computes B as a function of P for a wire that runs along the z-axis with 1000 Amps of current running in the -z direction. Compute the trajectory of a particle with initial position P = [-1 0 0] and initial velocity V = [0 0.1 0] You should include the force of gravity, but no drag. What happens if you add a very small amount of drag? What happens if you add more drag?