FunctionCenter of gravity of an MZ matrix over explicitly given X and Y axes
Syntax C/C++#include <MFstd.h>
fComplex MF_centerOfGravityV( fVector X, fVector Y, fMatrix MZ, ui ht, ui len );
C++ VecObj#include <OptiVec.h>
complex<T> matrix<T>::centerOfGravityV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses MFstd;
procedure MF_centerOfGravityV( var COG:fComplex; X, Y:fVector; MZ:fMatrix; ht, len:UIntSize );
DescriptionThe center of gravity of the matrix MZ is determined. It is assumend that the values of MZ represent point masses situated at the coordinates specified by the vectors X and Y. The center of gravity is returned as a complex number whose real part contains the X coordinate and whose imaginary part contains the Y coordinate. Please note that this ordering of the coordinates is different from the ordering of matrix element indices (where the first index gives the i-th row, in other words, the Y coordinate). If all elements of MA are 0, there is no mass and, strictly speaking, no center of gravity. In this case, the center of gravity is assumed as the geometrical center of MA, i.e. as ( (X[size-1)] - X[0]) / 2; (X[size-1)] - X[0]) / 2; ).
In order to calculate the center of gravity of an MZ matrix over the element indices, call MF_centerOfGravityInd.
Return value(Interpolated) coordinates of the center of gravity
See alsoMF_centerOfGravityInd

MatrixLib Table of Contents  OptiVec home