Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Motion of charged particle in a spatially varing electromagnetic field

Status
Not open for further replies.

1keenan

Newbie level 2
Newbie level 2
Joined
Feb 6, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
Hi all,

Hope this is the right place for may question.


I have to simulate the motion of particle in an electromagnetic device which deflects particle using electric and magnetic field.
Those field are arranged in such a way that the electric field is inside the magnetic one. Moreover the electrodes begin at the center of the magnetic field ad their end is a bit outside the coils.
The motion equations are:
1) d^2x(z)/dz^2 = qE/mv^2
2) d^2y(z)/dz^2 = qB/mv

The problem is that MatLab cannot solve second order differential equation, thus I have tried to use the code:

Code:
%%Initial drift
rhsE1=@(z,x)[x(2); 0];
[zaE1, xaE1] = ode45(rhsE1, [0 69], [0 0]);
%%inside E field
  E=1;
  rhsE =@(z,x)[x(2); (q/m)*(E/v^2)];
  [zaE, xaE] = ode45(rhsE, [70 130], [0 0]);

For the drift after the field I have calculated the derivative of the trajectory and used it as initial condition for solving the eqaution of motion in the drift sector.
I have also write a similar code for the magnetic field.
The problem is that solving the equation separately doesn't seem to me correct because one solution could be longer than the other...

I have also tryed to solve the lorentz force using the code:
Code:
%%%%
f = @(t,y) [y(4:6); (q_over_m).*cross(y(4:6),B)+(q_over_m).*E];
[t,y] = ode23t(f,tspan,y0);
%%%

and some "while" loop like:

Code:
%%%
while (z>= length at which B begins ||  z<= length atwhich the electric field begins)
     B=[1 0 0]';
     E = [0 0 0]';
   solve the equation
  z=y(end,3);
end
%%%%%

and so on...

The problem is that the code is incredibly slow and sometimes, I think, it cannot get out of a loop.

I think I have used bad approaches to solve the problem, someone can give me a clue?

P.S.: I can provide the full codes I have wrote down if you want to have a look at th
 

I have found what was wrong in my code, it is able to track a particle all the way long from the source to the detector and inside the field... I hope... The trajectory seems to be reasonable, I would need someone to double check it for confirmation. Is there someone available to test the code for me? I can post it here or send in private, doesn't matter
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top