当前位置: 首页>>代码示例>>C#>>正文


C# Complex.Count方法代码示例

本文整理汇总了C#中Complex.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Complex.Count方法的具体用法?C# Complex.Count怎么用?C# Complex.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Complex的用法示例。


在下文中一共展示了Complex.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BackwardTransform

 public double[] BackwardTransform(Complex[] mas)
 {
     mas = GetArrayInRightOrder(FFT(mas, false));
     
     var results = new double[mas.Count()];
     for (int i = 0; i < results.Length; i++ )
     {
         results[i] = mas[i].Real/results.Length;
     }
     
     return results;
 }
开发者ID:drodov,项目名称:DPSI,代码行数:12,代码来源:FourierTransformLib.cs

示例2: FFT

        private Complex[] FFT(Complex[] mas, bool isForward)
        {
            int N = mas.Count();

            Complex Wn = CalculateWn(isForward, N);
            int k = mas.Length;
            var y = new Complex[k];
            var W = new Complex(1, 0);
            for (int j = 0; j < k / 2; j++)
            {
                y[j] = mas[j] + mas[j + k / 2];
                y[j + k / 2] = W * (mas[j] - mas[j + k / 2]);
                W = W * Wn;
            }

            var mas11 = new Complex[N / 2];
            var mas22 = new Complex[N / 2];
            for (int i = 0; i < N / 2; i++ )
            {
                mas11[i] = y[i];
                mas22[i] = y[i + N / 2];
            }

            if (N > 2)
            {
                mas11 = FFT(mas11, isForward);
                mas22 = FFT(mas22, isForward);
            }

            var masRes = new Complex[N];
            for (int i = 0; i < N / 2; i ++ )
            {
                masRes[i] = mas11[i];
                masRes[i + N / 2] = mas22[i];
            }

            return masRes;
        }
开发者ID:drodov,项目名称:DPSI,代码行数:38,代码来源:FourierTransformLib.cs

示例3: ButterflyMethod

 private Complex[] ButterflyMethod(Complex[] a, bool isForward)
 {
     Complex Wn = CalculateWn(isForward, a.Count());
     int k = a.Length;
     var y = new Complex[k];
     var W = new Complex(1, 0);
     for(int j = 0; j < k / 2; j++)
     {
         y[j] = a[j] + a[j + k / 2];
         y[j + k / 2] = W * (a[j] - a[j + k / 2]);
         W = W * Wn;
     }
     return y;
 }
开发者ID:drodov,项目名称:DPSI,代码行数:14,代码来源:FourierTransformLib.cs

示例4: IIR_Spectrum_Objective

                    public IIR_Spectrum_Objective(int Filter_Order, Complex[] BasisSpectrum, int samplingFrequency)
                    {
                        //Find all local maxima (within 10 points)
                        List<int> maxima = new List<int>();
                        freq = new double[BasisSpectrum.Length];
                        for (int i = 10; i < BasisSpectrum.Length-10; i++)
                        {
                            bool max = true;
                            for (int s = -10; s < 10; s++)
                            {
                                if (BasisSpectrum[i].Real < BasisSpectrum[i + s].Real)
                                {
                                    max = false;
                                    continue;
                                }
                            }
                            if (max) maxima.Add(i);
                        }

                        fs = samplingFrequency;

                        for (int i = 0; i < freq.Length; i++) freq[i] = (double)(i * samplingFrequency) / freq.Length;

                        pole_phase = new double[maxima.Count];
                        for (int i = 0; i < maxima.Count; i++) pole_phase[i] = 2 * Math.PI * maxima[i] / BasisSpectrum.Count();

                        if (Filter_Order < maxima.Count * 2) Filter_Order = maxima.Count * 2;

                        pzct = Filter_Order;
                        pno_conj = (int)Math.Floor((double)pzct / 2);
                        pno_conj_phase = (int)Math.Floor((double)pzct / 2 - maxima.Count());
                        pno_real = pzct % 2;
                        zno_real = pzct;
                        Spectrum = BasisSpectrum;
                        n = BasisSpectrum.Length;
                        fs = samplingFrequency;
                        sampled = new int[24];
                        sel_Spectrum = new Complex[24];
                        sel_freq = new double[24];
                        abs = new Complex[24];

                        for (int i = 0; i < 24; i++)
                        {
                            double f = 24.803 * Math.Pow(2, (double)i/3);
                            sampled[i] = (int)(f * 2 * BasisSpectrum.Length / samplingFrequency);
                            sel_Spectrum[i] = Spectrum[sampled[i]];
                            abs[i] = AbsorptionModels.Operations.Absorption_Coef(sel_Spectrum[i]);
                            sel_freq[i] = freq[sampled[i]];
                        }
                    }
开发者ID:MengdiGuo,项目名称:PachydermAcoustic_Rhinoceros,代码行数:50,代码来源:Pach_SP_IIR.cs


注:本文中的Complex.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。