Exemplo n.º 1
0
        public void mLineAutoSpectr(double[] temparr, int imgW, int imgH)
        {
            Random r       = new Random();
            int    lineInd = r.Next(0, imgH);

            double[] line    = temparr.Skip(lineInd * imgW).Take(imgW).ToArray <double>();
            double[] dLineDt = new double[imgW];
            for (int i = 0; i < imgW - 2; i++)
            {
                dLineDt[i] = line[i] - line[i + 1];
            }
            ComplexNum[] lineAutocor = new ComplexNum[imgW];
            for (int i = 0; i < imgW; i++)
            {
                lineAutocor[i] = new ComplexNum(Statistics.Crosscorrelation(dLineDt, dLineDt, i));
            }

            FourierTransfom ft     = new FourierTransfom();
            double          Fgr    = 1.0 / 1;
            double          Fdelta = Fgr / lineAutocor.Length;

            ComplexNum[] res = ft.mTransform(lineAutocor);
            for (int i = 0; i < mCount; i++)
            {
                mArguments[i] = i * Fdelta;
            }
            mFunc = t => res[t].abs;
        }
Exemplo n.º 2
0
        /// <summary>
        /// unused
        /// </summary>
        public void mSetAutocor(double [] arr)
        {
            int[] x = new int[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                x[i] = i;
            }

            double[] y = new double[x.Length];

            mFunc = t => Statistics.Crosscorrelation(arr, arr, t);
        }
Exemplo n.º 3
0
        private void DrawCrossCorrelation(int[] x, Chart chart, DataPointCollection arr1, DataPointCollection arr2, string functionName)
        {
            chart.Series.Clear();
            Series series = chart.Series.Add(functionName);

            series.ChartType = SeriesChartType.Spline;
            double[] y = new double[x.Length];
            for (int i = 0; i < x.Length; i++)
            {
                series.Points.AddXY(x[i], Statistics.Crosscorrelation(arr1, arr2, x[i]));
            }
        }