function r = motionestat(r0,v0,E)
%EEMAG1 Fall 99
%S. Mandayam, Rowan University, ECE Dept.
%Motion of an electron in an electrostatic field
%Usage: r = motionestat (r0, v0, E)
%r = 3x50 matrix of x,y,z position coordinates
%r0 = 1x3 vector of x,y,z initial position coordinates
%v0 = 1x3 vector of x,y,z components of initial velocity
%E = 1x3 vector of x,y,z components of electric field intensity

close all;

q=-1.6e-19; m=9.31e-31;

t=0:10e-9:100e-9;
rx=(q*E(1)*t.^2)/(2*m) + v0(1)*t + r0(1);
ry=(q*E(2)*t.^2)/(2*m) + v0(2)*t + r0(2);
rz=(q*E(3)*t.^2)/(2*m) + v0(3)*t + r0(3);

plot3(rx',ry',rz','ro');
hold;plot3(rx',ry',rz','*');
grid on;

r=[rx',ry',rz'];
xlabel('x');ylabel('y');zlabel('z');
title('Motion of an electron in an electrostatic field');
rotate3d on;
