ocmath_2d_integrate

 

Description

To compute the volume beneath the surface defined by the matrix, starting from zero-level.

Syntax

double ocmath_2d_integrate( const uint nRows, const uint nCols, const double dXMin, const double dYMin, const double dXMax, const double dYMax, const double * pMat )

Parameters

nRows
[input] Number of rows of input matrix pMat.
nCols
[input] Number of cols of input matrix pMat.
dXMin
[input] Minimum of X coordinate.
dYMin
[input] Minimum of Y coordinate.
dXMax
[input] Maximum of X coordinate.
dYMax
[input] Maximum of Y coordinate.
pMat
[input] The matrix to be computed.

Return

Return the integration restult, or cause run time error if pMat is NULL.

Examples

EX1

// Assuming the active window is the matrix to be integrated.
void ocmath_2d_integrate_ex1()
{
    MatrixLayer ml = Project.ActiveLayer();
    MatrixObject mo = ml.MatrixObjects(0);
    
    double nRows = mo.GetNumRows();
    double nCols = mo.GetNumCols();
    
    double dXMin, dYMin, dXMax, dYMax;
    mo.GetXY(dXMin, dYMin, dXMax, dYMax);
    
    Matrix& mat = mo.GetDataObject();
    double dRet = ocmath_2d_integrate(nRows, nCols, dXMin, dYMin, dXMax, dYMax, mat);
    
    string strName;
    ml.GetName(strName);
    printf("Integration of %s from zero is: %G\n", strName, dRet);
}

Remark

See Also

ocmath_integrate, ocmath_numeric_integral

header to Include

origin.h

Reference