Calculate mean value.

Namespace:  AForge.Math
Assembly:  AForge.Math (in AForge.Math.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public static double Mean(
	int[] values
)

Parameters

values
Type: array< System..::.Int32 >[]()[]
Histogram array.

Return Value

Returns mean value.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Sample usage:

CopyC#
// create histogram array
int[] histogram = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// calculate mean value
double mean = Statistics.Mean( histogram );
// output it (5.759)
Console.WriteLine( "mean = " + mean.ToString( "F3" ) );

See Also