Exemplo n.º 1
0
        public IEnumerable <Point> Filtration(int M, double fo, IEnumerable <Point> points, IWindow window,
                                              FilterType filterType)
        {
            var fp = 1 / (points.ElementAt(1).X - points.ElementAt(0).X);

            if (filterType == FilterType.HighPassFilter)
            {
                fo = fp / 2 - fo;
            }

            var response = new List <Point>();
            var K        = fp / fo;

            for (var i = 0; i < M; i++)
            {
                response.Add(new Point(i,
                                       ImpulseResponse.Response(i, K, M) * window.Window(i, M) * filterTypes[filterType](i)));
            }

            var ret       = Convolution.Convolute(points, response);
            var amplitude = ret.Select(p => p.Y).Max() * 2;

            amplitude = points.Select(p => p.Y).Max() / amplitude;

            foreach (var point in ret)
            {
                point.Y *= amplitude;
            }

            return(ret);
        }
Exemplo n.º 2
0
        public void ConvoluteTest()
        {
            var convolution = Convolution.Convolute(first, second).ToList();

            for (int i = 0; i < 6; i++)
            {
                Assert.AreEqual(convolution[i].Y, result[i].Y);
            }
        }
Exemplo n.º 3
0
        public void Proceed()
        {
            if (IsAllChecked())
            {
                FinalSignal = Convolution.Convolute(FirstSignal, SecondSignal);

                BindCharts();

                OutputSignal.Text = OuputString;
            }
        }
Exemplo n.º 4
0
        private void ConvolutionTest(object obj)
        {
            var first  = FirstSignalViewModel.SignalData;
            var second = SecondSignalViewModel.SignalData;

            first.Duration.Value  = 5;
            second.Duration.Value = 5;
            //first.StartTime.Value = 0.3d;
            FirstSignalViewModel.GenerateSignalCommand.Execute(null);
            SecondSignalViewModel.GenerateSignalCommand.Execute(null);

            SecondSignalViewModel.SignalData.Points = Convolution.Convolute(first.Points, second.Points).ToList();
        }