public static void generate_mixed_PSK_signal(int PSK_num, int[] symbols_in_message, double duration_of_signal, double Fd, double[] T, double[] Fc, int[] M, double[] init_phase, int[] samples_per_symbol, double[] A, out double[] t, alglib.complex[] noise, out alglib.complex[] mixed_signal_without_noise)
        {
            t = new double[0];
            mixed_signal_without_noise = new alglib.complex[(int)(duration_of_signal * Fd)];
            for (int i = 0; i < PSK_num; i++)
            {
                int[] message = new int[symbols_in_message[i]];
                Random rand = new Random();
                for (int j = 0; j < message.Length; j++)
                {
                    message[j] = rand.Next(M[i]);
                }
                PSK psk = new PSK(M[i], init_phase[0], T[i], samples_per_symbol[i]);
                alglib.complex[] signal;


                PSK.create_RF_signal(psk.modulate(message), Fd, duration_of_signal, Fc[i], 1, out signal, out t);
                psk_band_filtering(ref signal, 1.0 / T[i], Fd, Fc[i]);
                double coeff = get_null_dB_mag(signal, noise, 1.0 / T[i], Fd);
                double new_coeff = Math.Sqrt(coeff * coeff * Math.Pow(10, A[i] / 10.0));



                for (int j = 0; j < signal.Length; j++)
                {
                    mixed_signal_without_noise[j] += new_coeff * signal[j];
                    t[j] = j / Fd;
                }
            }
        }
        }//добавление АБГШ
        public static void generate_mixed_PSK_signal(int PSK_num, int[] symbols_in_message, double duration_of_signal, double Fd, double[] T, double[] Fc, int[] M, double[] init_phase, int[] samples_per_symbol, double[] A, out double[] t, out alglib.complex[] mixed_signal)//Амплитуды в децибелах
        {
            t = new double[0];
            mixed_signal = new alglib.complex[(int)(duration_of_signal * Fd)];
            alglib.complex[] noise = create_AWGN(mixed_signal.Length);

            for (int i = 0; i < PSK_num; i++)
            {
                int[] message = new int[symbols_in_message[i]];
                Random rand = new Random();
                for (int j = 0; j < message.Length; j++)
                {
                    message[j] = rand.Next(M[i]);
                }
                PSK psk = new PSK(M[i], init_phase[0], T[i], samples_per_symbol[i]);
                alglib.complex[] signal;


                PSK.create_RF_signal(psk.modulate(message), Fd, duration_of_signal, Fc[i], 1, out signal, out t);
                psk_band_filtering(ref signal, 1.0 / T[i], Fd, Fc[i]);
                double coeff = get_null_dB_mag(signal, noise, 1.0 / T[i], Fd);
                double new_coeff = Math.Sqrt(coeff * coeff * Math.Pow(10, A[i] / 10.0));



                for (int j = 0; j < signal.Length; j++)
                {

                    mixed_signal[j] += new_coeff * signal[j];
                }

                /*double signal_energ = 0;
                double noise_energ = 0;
                for (int j = 0; j < signal.Length; j++)
                {
                    signal_energ += Math.Pow(alglib.math.abscomplex(new_coeff * signal[j]), 2);
                }
                for (int j = 0; j < noise.Length; j++)
                {
                    noise_energ += Math.Pow(alglib.math.abscomplex(noise[j]), 2);
                }
                noise_energ = noise_energ * 2 * (1 / T[i]) / Fd;
                double SNR = 10 * Math.Log10(signal_energ / noise_energ);*/

            }
            for (int j = 0; j < mixed_signal.Length; j++)
            {
                mixed_signal[j] += noise[j];
                t[j] = j / Fd;
            }

        }