You've already forked lazarus-ccr
LazStats: Refactor ResistanceLineUnit, use report-and-chart template form.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7755 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -51,11 +51,14 @@ procedure Calc_MeanVarStdDev(const AData: DblDyneVec; out AMean, AVariance, AStd
|
||||
procedure Calc_MeanVarStdDevSS(const AData: DblDyneVec; out AMean, AVariance, AStdDev, ASumOfSquares: Double);
|
||||
procedure Calc_SumSS(const AData: DblDyneVec; out Sum, SS: Double);
|
||||
|
||||
function Calc_Median(const AData: DblDyneVec): Double;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
Math,
|
||||
Utils;
|
||||
|
||||
// Calculates the error function
|
||||
// /x
|
||||
@ -572,6 +575,21 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function Calc_Median(const AData: DblDyneVec): Double;
|
||||
var
|
||||
N, midPt: integer;
|
||||
begin
|
||||
SortOnX(AData);
|
||||
|
||||
N := Length(AData);
|
||||
midPt := N div 2;
|
||||
if odd(N) then
|
||||
Result := AData[midPt] // odd no. of values
|
||||
else
|
||||
Result := (AData[midPt-1] + AData[midPt]) / 2; // even no. of values
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
InitFactLn();
|
||||
|
||||
|
Reference in New Issue
Block a user