%Muhammad Adnan Malik 09ES51 function r = motionestat(r0,v0,E,t) r0=input('Enter initial position = '); v0=input('Enter initial velocity = '); E=input

('Enter Electric field components = '); t =input('Enter Time Peroid = ' ); %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; 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;

Sign up to vote on this title
UsefulNot useful