Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. function msd_t = msd_ind(xcoors,ycoors,particle_num,timestep,base)
  2. % This function returns the mean square displacement for a single particle
  3. % at a certain timestep, with reference to certain base value.
  4.  
  5. % It follows the formula: (1/N)(SUM_TO_N((r(i,t) - r(i,base))^2)) but
  6. % because N = 1 (because we are using only one individual particle), we
  7. % remove the SUM and (1/N). Splitting r into it's x and y parts gives msd =
  8. % change_in_x^2 + change_in_y^2.
  9. cx = xcoors(particle_num,timestep+1) - xcoors(particle_num,base);
  10. cy = ycoors(particle_num,timestep+1) - ycoors(particle_num,base);
  11. msd_t = cx^2 + cy^2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement