Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x1">Interpolated Data OX (new abscissa)</param>
        /// <param name="y1">Interpolated Data OY (new ordinate)</param>
        static void ExampleWithArrays(out double[] x1, out double[] y1)
        {
            Console.WriteLine("Example With Arrays : Start.\n");
            x1 = null;
            y1 = null;
            int    N  = 40;
            double Fs = 20.0;

            double[] x = new double[N];
            double[] y = new double[N];

            x1 = new double[2 * N - 1];                             /* new data X */

            for (int i = 0; i < N; i++)
            {
                x[i] = i / Fs;
                y[i] = Math.Sin(2.0 * Math.PI * x[i]);
            }

            for (int i = 0; i < x1.Length; i++)
            {
                x1[i] = i / (2.0 * Fs);
            }

            y1 = Interpolation.CubicInterpolation(x, y, x1);        /* new data Y */

            Console.WriteLine("Example With Arrays : Enjoy.\n");
        }