function ydot=quad(t,y,m)
r=[y(1);y(2);y(3)];
v=[y(4);y(5);y(6)];
global q Vtb Vlr Rtop Rbottom Rleft Rright
rtop=10^-6*[Rtop(1)-r(2);Rtop(2)-r(3)];
rbottom=10^-6*[Rbottom(1)-r(2);Rbottom(2)-r(3)];
rleft=10^-6*[Rleft(1)-r(2);Rleft(2)-r(3)];
rright=10^-6*[Rright(1)-r(2);Rright(2)-r(3)];
Ftop=-q*Vtb/norm(rtop)^2*rtop;
Fbottom=-q*Vtb/norm(rbottom)^2*rbottom;
Fleft=-q*Vlr/norm(rleft)^2*rleft;
Fright=-q*Vlr/norm(rright)^2*rright;
a=10^4*(Ftop+Fbottom+Fleft+Fright)./m;
ydot=[y(4);y(5);y(6);0;a(1);a(2)];