TRAJWRAP Wraps Lagrangian trajectories to fit within a periodic domain. CX=TRAJWRAP(CX,L) wraps the complex-valued Lagrangian trajectory CX to fit within the doubly periodic domain with edges at +/- L. CX specifies the particle position in complex-valued form CX=X+iY. CX may be of any dimension, but time is assumed to increase along rows. The output array will be the same size as the input array. Set L=[LX LY] to specify different periodicities in the X and Y directions. Use L=[LX NaN] for only zonal periodicity, or L=[NaN Ly] for only meridional periodicity. CX=TRAJWRAP(CX,L,'nans') optionally sets the discontinuties resulting from wrapping to values of NaN, for plotting purposes. Note that the output is in this case still the same size as the input. [CX1,CX2,...,CXN]=TRAJWRAP(CX1,CX2,...CXN,L) also works for multiple arrays of trajectories with the same periodicity. TRAJWRAP(CX1,CX2,...CXN,L); with no output arguments overwrites the original named input variables. See also TRAJUNWRAP. 'trajwrap --t' runs a test. 'trajwrap --f' generates a sample figure. Usage: cx=trajwrap(cx,L); cx=trajwrap(cx,[Lx Ly],'nan'); cx=trajwrap(cx,[Lx Ly]); [cx1,cx2]=trajwrap(cx1,cx2,[Lx Ly]); trajwrap(cx1,cx2,[Lx Ly]); __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2014--2015 J.M. Lilly --- type 'help jlab_license' for details