CURVEMOMENTS Centroid, area, and many other moments of a closed curve. _______________________________________________________________________ ______________________________________________________________________ [XO,YO]=CURVEMOMENTS(XC,YC) returns the centroid of the region bounded by the closed curve specified by the column vectors XC and YC. [XO,YO,L,R,D]=CURVEMOMENTS(XC,YC) also returns the arc length L, area radius R defined such that pi R^2 is the enclosed area, and the root- mean-squared distance D from the curve periphery to the centroid. [XO,YO,L,R,D,A,B,THETA]=CURVEMOMENTS(XC,YC) also returns the region's second central moment, the area moment of inertia. This describes an ellipse with semi-major and minor axes A and B, and orientation THETA. The moments are calculated from the curve (XC,YC) using expressions for converting spatial to line integrals derived from Green's theorem. XC and YC may be matrices, with each column specifying a different closed curve. In this case, all curves must contain the same number of points, corresponding to the rows. No NaNs may be present. XC and YC may also be cell arrays of column vectors. In this case, the moments will be numerical arrays with the same lengths as XC and YC. The above figure illustrates an application of CURVEMOMENTS to a quasigeostrophic eddy field from QGSNAPSHOT. The blue curves are curves of constant Okubo-Weiss parameter. These are well matched by the red curves, constructed from the second central moment quantites A, B, and THETA, and centered at the curve centroids XO, YO. __________________________________________________________________ Velocity moments: Vorticity, angular momentum, kinetic energy, etc. CURVEMOMENTS can also compute various moments based on the velocity. [VORT,DIV,MOM,KE]=CURVEMOMENTS(XC,YC,ZC) where ZC is the complex-valued velocity ZC=U+iV along the curve, returns the spatially-averaged vorticity VORT, the spatially-averaged divergence MOM, and the angular momentum MOM and kinetic energy KE averaged along the curve periphery. For the velocity moments, CURVEMOMENTS expects XC and YC to have units of km while ZC is in cm/s. VORT and DIV then have units of 1/s, MOM and MOMSTD have units of cm^2/s, and KE has units of cm^2/s^2. Note that VORT and DIV are computed as integrals of the tangential and normal velocities along the curve, respectively, then converted to area averages by applying Stokes' theorem and the divergence theorem. MOM is the average angular momentum along the curve with respect to the curve centroid. KE is the average value of the kinetic energy along the curve, a velocity quantity analagous to averaged squared distance D^2. __________________________________________________________________ See also CLOSEDCURVES, CURVEINTERP. 'curvemoments --t' runs some tests. 'curvemoments --f' generates the above figure. Usage: [xo,yo]=curvemoments(xc,yc); [xo,yo,L,R,D]=curvemoments(xc,yc); [xo,yo,L,R,D,a,b,theta]=curvemoments(xc,yc); [vort,div,mom,ke,momstd]=curvemoments(xc,yc,zc); __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2013--20154 J.M. Lilly --- type 'help jlab_license' for details