public void Compute()
        {
            SelectedSignal1Tab.TabContent.Data.FromSamples = true;
            SelectedSignal2Tab.TabContent.Data.FromSamples = true;
            if (SelectedSignal1Tab.TabContent.Data.HasData() && SelectedSignal2Tab.TabContent.Data.HasData())
            {
                if (!SelectedSignal2Tab.TabContent.Data.IsValid(SelectedSignal1Tab.TabContent.Data))
                {
                    MessageBox.Show("Given signals are not valid", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                DataHandler data = new DataHandler();
                List<double> pointsY = new List<double>();

                switch (SelectedOperation.Substring(1, 2))
                {
                    case "D1":
                        pointsY = SignalOperations.AddSignals(SelectedSignal1Tab.TabContent.Data.Samples,
                            SelectedSignal2Tab.TabContent.Data.Samples);
                        break;
                    case "D2":
                        pointsY = SignalOperations.SubtractSignals(SelectedSignal1Tab.TabContent.Data.Samples,
                            SelectedSignal2Tab.TabContent.Data.Samples);
                        break;
                    case "D3":
                        pointsY = SignalOperations.MultiplySignals(SelectedSignal1Tab.TabContent.Data.Samples,
                            SelectedSignal2Tab.TabContent.Data.Samples);
                        break;
                    case "D4":
                        pointsY = SignalOperations.DivideSignals(SelectedSignal1Tab.TabContent.Data.Samples,
                            SelectedSignal2Tab.TabContent.Data.Samples);
                        break;
                }

                data.StartTime = SelectedSignal1Tab.TabContent.Data.StartTime;
                data.Frequency = SelectedSignal1Tab.TabContent.Data.Frequency;
                data.Samples = pointsY;
                data.FromSamples = true;
                SelectedResultTab.TabContent.IsScattered = true;
                SelectedResultTab.TabContent.LoadData(data);
                SelectedResultTab.TabContent.AddOriginal = false;
                SelectedResultTab.TabContent.AddSamples = false;
                SelectedResultTab.TabContent.DrawCharts();
                SelectedResultTab.TabContent.CalculateSignalInfo(isDiscrete: true, fromSamples: true);
            }

        }
        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));
        }
        public void ComputeSignals()
        {
            if (SelectedSignal1 != null && SelectedSignal2 != null)
            {
                if (IsComplex)
                {
                    SampledSignal  signal = new SampledSignal();
                    List <Complex> points = new List <Complex>();

                    switch (SelectedOperation.Substring(1, 2))
                    {
                    case "D1":
                        points = SignalOperations.AddComplexSignals(SelectedSignal1.ComplexPoints,
                                                                    SelectedSignal2.ComplexPoints);
                        break;

                    case "D2":
                        points = SignalOperations.SubtractComplexSignals(SelectedSignal1.ComplexPoints,
                                                                         SelectedSignal2.ComplexPoints);
                        break;

                    case "D3":
                        points = SignalOperations.MultiplyComplexSignals(SelectedSignal1.ComplexPoints,
                                                                         SelectedSignal2.ComplexPoints);
                        break;

                    case "D4":
                        points = SignalOperations.DivideComplexSignals(SelectedSignal1.ComplexPoints,
                                                                       SelectedSignal2.ComplexPoints);
                        break;
                    }
                    signal.ComplexPoints = points;
                    signal.Name          = ResultSignalName + " - S [Complex]";
                    SignalCreator.Signals.Add(signal);
                    SignalCreator.SampledSignals.Add(signal);
                }
                else
                {
                    if (!SelectedSignal2.IsValid(SelectedSignal2))
                    {
                        MessageBox.Show("Given signals are not valid", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    SampledSignal signal  = new SampledSignal();
                    List <double> pointsY = new List <double>();

                    switch (SelectedOperation.Substring(1, 2))
                    {
                    case "D1":
                        pointsY = SignalOperations.AddSignals(SelectedSignal1.PointsY,
                                                              SelectedSignal2.PointsY);
                        break;

                    case "D2":
                        pointsY = SignalOperations.SubtractSignals(SelectedSignal1.PointsY,
                                                                   SelectedSignal2.PointsY);
                        break;

                    case "D3":
                        pointsY = SignalOperations.MultiplySignals(SelectedSignal1.PointsY,
                                                                   SelectedSignal2.PointsY);
                        break;

                    case "D4":
                        pointsY = SignalOperations.DivideSignals(SelectedSignal1.PointsY,
                                                                 SelectedSignal2.PointsY);
                        break;
                    }
                    signal.PointsY   = pointsY;
                    signal.StartTime = SelectedSignal1.StartTime;
                    signal.Frequency = SelectedSignal1.Frequency;
                    signal.CalculateSamplesX();
                    signal.Name = ResultSignalName + " - S";
                    SignalCreator.Signals.Add(signal);
                    SignalCreator.SampledSignals.Add(signal);
                }
            }
        }