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); }
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); } }
public void Proceed() { if (IsAllChecked()) { FinalSignal = Convolution.Convolute(FirstSignal, SecondSignal); BindCharts(); OutputSignal.Text = OuputString; } }
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(); }