public void CalculateSignalsStats(DiscreteSignal signal, Params parameters) { if (signal != null) { List <double> samples = signal.Values.Select(tuple => tuple.Y.Real).ToList(); double t1 = parameters.t1; double t2 = t1 + parameters.d; bool isDiscrete = false; Stats.AverageValue = StatsCalculator.AverageValue(samples, t1, t2, isDiscrete).ToString("0." + new string('#', 339)); Stats.AverageAbsValue = StatsCalculator.AbsAverageValue(samples, t1, t2, isDiscrete).ToString("0." + new string('#', 339)); Stats.RootMeanSquare = StatsCalculator.RootMeanSquare(samples, t1, t2, isDiscrete).ToString("0." + new string('#', 339)); Stats.Variance = StatsCalculator.Variance(samples, t1, t2, isDiscrete).ToString("0." + new string('#', 339)); Stats.AveragePower = StatsCalculator.AveragePower(samples, t1, t2, isDiscrete).ToString("0." + new string('#', 339)); } }
public void VarianceIntTest() { var mean = statsCal.Variance(values); Assert.AreEqual(5, mean); }