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