function dy = archive_path(t,y) %********************************************************************* % Function to get interpolated (u,v) velocities from a velocity % archive %********************************************************************* % This function is used by trajectories.m to define a system of % 2*N path equations for use in integrating N particle trajectories % using a discrete velocity archive. %********************************************************************* global u v X Y T extrap_val = 0 ; ntraj = length(y)/2 ; dy = zeros(size(y)) ; xpts = (1:ntraj)' ; ypts = (ntraj+1:length(y))' ; time = t+zeros(size(xpts)) ; dy(xpts) = interpn(X,Y,T,u,y(xpts),y(ypts),time,'cubic',extrap_val) ; dy(ypts) = interpn(X,Y,T,v,y(xpts),y(ypts),time,'cubic',extrap_val) ;