MOVEOBJECTS This function moves object positions according to the specified parameters Inputs: pos = nx3 array of current positions for n objects in 3D Dc = diffusion coefficient (um^2/second) dt = time step Outputs: Written by: Devin Sullivan 7/18/13
0001 function newpos = moveObjects(pos,Dc,dt,param) 0002 %MOVEOBJECTS This function moves object positions according to the specified parameters 0003 % 0004 %Inputs: 0005 %pos = nx3 array of current positions for n objects in 3D 0006 %Dc = diffusion coefficient (um^2/second) 0007 %dt = time step 0008 % 0009 %Outputs: 0010 % 0011 %Written by: Devin Sullivan 7/18/13 0012 0013 % Copyright (C) 2013 Murphy Lab 0014 % Carnegie Mellon University 0015 % 0016 % This program is free software; you can redistribute it and/or modify 0017 % it under the terms of the GNU General Public License as published 0018 % by the Free Software Foundation; either version 2 of the License, 0019 % or (at your option) any later version. 0020 % 0021 % This program is distributed in the hope that it will be useful, but 0022 % WITHOUT ANY WARRANTY; without even the implied warranty of 0023 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0024 % General Public License for more details. 0025 % 0026 % You should have received a copy of the GNU General Public License 0027 % along with this program; if not, write to the Free Software 0028 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0029 % 02110-1301, USA. 0030 % 0031 % For additional information visit http://murphylab.web.cmu.edu or 0032 % send email to murphy@cmu.edu 0033 0034 param = ml_initparam(param,struct('method','brownian')); 0035 0036 switch param.method 0037 case 'brownian' 0038 newpos = pos+randn(size(pos,1),3)*Dc*sqrt(dt); 0039 0040 otherwise 0041 warning('Unrecognized object movement method, returning initial positions.'); 0042 newpos = pos; 0043 end