Example #1
0
        public static double[] Integrate(this IEnumerable <double> x, IEnumerable <double> y, Interpolation order = Interpolation.ZeroOrder)
        {
            if (x == null || y == null || x.Count() != y.Count())
            {
                throw new ArgumentException("x and y data must not be null, and must have same length.");
            }

            //Formiramo interpolante za oba signala
            var interpolant = FetchInterpolant(order)(x, y);

            return(x.Select(p => interpolant.Integrate(p)).ToArray());
        }
Example #2
0
        public static IEnumerable <DoublePair> Integrate(this IEnumerable <DoublePair> x, Interpolation order = Interpolation.ZeroOrder)
        {
            if (x == null)
            {
                throw new ArgumentException("x and y data must not be null, and must have same length.");
            }

            //Formiramo interpolante za oba signala
            var interpolant = FetchInterpolant(order)(x.Select(p => p.Item1), x.Select(p => p.Item2));

            return(x.Select(p => new DoublePair(p.Item1, interpolant.Integrate(p.Item1))));
        }