public static List <Complex> Transform(List <double> points)
        {
            List <Complex> transformed = new List <Complex>();
            List <double>  xh          = Convolution.ComputeSignal(points, H).Take(points.Count).ToList();
            List <double>  xg          = Convolution.ComputeSignal(points, G).Take(points.Count).ToList();
            List <double>  xhHalf      = new List <double>();
            List <double>  xgHalf      = new List <double>();

            for (int i = 0; i < xh.Count; i++)
            {
                if (i % 2 == 0)
                {
                    xhHalf.Add(xh[i]);
                }
                else
                {
                    xgHalf.Add(xg[i]);
                }
            }
            for (int i = 0; i < xgHalf.Count; i++)
            {
                transformed.Add(new Complex(xhHalf[i], xgHalf[i]));
            }
            return(transformed);
        }
예제 #2
0
 public void Convolute()
 {
     if (SelectedSignal1 != null && SelectedSignal1.HasData() && SelectedSignal2 != null && SelectedSignal2.HasData())
     {
         SampledSignal signal = new SampledSignal();
         signal.PointsY = Convolution.ComputeSignal(SelectedSignal1.PointsY, SelectedSignal2.PointsY);
         signal.Name    = $"({SelectedSignal1.Name})*({SelectedSignal2.Name})";
         SignalCreator.AddSignal(signal);
     }
 }
예제 #3
0
 public void FilterMethod()
 {
     if (SelectedSignalFilter1 != null && SelectedSignalFilter1.HasData() && SelectedSignalFilter2 != null && SelectedSignalFilter2.HasData())
     {
         SampledSignal signal = new SampledSignal();
         signal.PointsY = Convolution.ComputeSignal(SelectedSignalFilter1.PointsY, SelectedSignalFilter2.PointsY).Skip((SelectedSignalFilter2.PointsY.Count - 1) / 2).Take(SelectedSignalFilter1.PointsY.Count).ToList();
         signal.Name    = $"({SelectedSignalFilter1.Name})*({SelectedSignalFilter2.Name})";
         SignalCreator.AddSignal(signal);
     }
 }
        public static List <double> ReverseTransform(List <Complex> points)
        {
            List <double> xh = new List <double>();
            List <double> xg = new List <double>();

            for (int i = 0; i < points.Count; i++)
            {
                xh.Add(points[i].Real);
                xh.Add(0);
                xg.Add(0);

                xg.Add(points[i].Imaginary);
            }
            List <double> xhC = Convolution.ComputeSignal(xh, HO).Take(xh.Count).ToList();
            List <double> xgC = Convolution.ComputeSignal(xg, GO).Take(xg.Count).ToList();

            return(SignalOperations.AddSignals(xhC, xgC));
        }