Ejemplo n.º 1
0
        public static Assignment5Result Analyze(double l, double h, Measurement[] measurements)
        {
            Point[] points = measurements.Select(m => new Point(m.Distance, m.TimeValues.Average(t => t * t))).ToArray();
            LeastSquaresFitResult result = Assignment5.LeastSquaresFit(points);

            return(new Assignment5Result
            {
                LeastSquaresFitResult = result,
                g = 2 * l / (result.Slope * h) / 100,
                StandardDeviation = Assignment5.StandardDeviationY(points, result)
            });
        }
Ejemplo n.º 2
0
 public static double StandardDeviationY(Point[] points, LeastSquaresFitResult result)
 {
     return(Math.Sqrt(points.Sum(p => Math.Pow(p.Y - (result.Intercept + result.Slope * p.X), 2)) / (points.Length - 2)));
 }