function dy = lorentzf(t,y)
%UNTITLED2 Summary of this function goes here
%   Detailed explanation goes here
global qm E betam mkr
dy=zeros(6,1);
dy(1)=y(4);
dy(2)=y(5);
dy(3)=y(6);
xx=y(1)/mkr;yy=y(2)/mkr;zz=y(3)/mkr;
[Bx,By,Bz]=magf(xx,yy,zz);
v=sqrt(power(y(4),2)+power(y(5),2)+power(y(6),2));
dy(4)=qm*(y(5)*Bz-y(6)*By+E(1))-betam*v*y(4);
dy(5)=qm*(y(6)*Bx-y(4)*Bz+E(2))-betam*v*y(5);
dy(6)=qm*(y(4)*By-y(5)*Bx+E(3))-betam*v*y(6);
end

