I want to simulate the trajectory of a particle in 3d so I have created this small simulation using this code:
nP=100; N=100; z=rand(nP,N); y=rand(nP,N);