//---------------------------------------------------------------------------------------------
        //Случайные фазовые сдвиги
        private double[] GetRandomPhaseShifts(int count)
        {
            double[] phaseShifts           = ArrayCreator.CreateRandomArray(count);
            ComputationalFunction function = new ComputationalFunction(delegate(double x) {
                return(x * 2 * Math.PI);
            });

            phaseShifts = ArrayOperator.ComputeFunction(phaseShifts, function);

            phaseShifts = new double[] { 0, 2 * Math.PI / 3, 4 * Math.PI / 3 };
            return(phaseShifts);
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------------------------------------
        //Вычисление функции для каждого значения массива
        public static double[] ComputeFunction(
            double[] array,
            ComputationalFunction function
            )
        {
            int size = array.Length;

            double[] newArray = new double[size];
            for (int index = 0; index < size; index++)
            {
                double value    = array[index];
                double newValue = function(value);
                newArray[index] = newValue;
            }
            return(newArray);
        }