private void DrawHeartBeat(double xDelta, int xCount, double hDelta, int hCount, Chart chart) { double f0 = Double.Parse(tbA12.Text); double alpha = Double.Parse(tbB12.Text); double spikes = Double.Parse(tbSpikes12.Text); chart.Series.Clear(); Series series = chart.Series.Add("f(x)"); series.ChartType = SeriesChartType.Spline; double[] h = new double[hCount]; double[] x = new double[xCount]; Func <double, double> hFun = (t => Math.Sin(2 * Math.PI * f0 * t) * Math.Exp(-alpha * t)); double dt = hDelta; for (int i = 0; i < h.Length; i++) { h[i] = hFun(i * dt); } for (int i = (int)(x.Length / spikes); i < x.Length; i = i + (int)(x.Length / spikes)) { x[i] = 110 + rnd.Next(0, 20); } double[] res = Transformations.ConvolutionFunction(h, x); for (int i = 0; i < res.Length; i++) { if (!Double.IsInfinity(res[i]) && !Double.IsNaN(res[i])) { series.Points.AddXY(i, res[i] + 1); } } }