void smoothDiffPoints()
        {
            if (threshold == 0d)
            {
                //no smoothing required
                return;
            }
            double yMin  = diffPoints.Min(s => s.Y);
            double range = diffPoints.Max(s => s.Y) - yMin;

            for (int i = 0; i < diffPoints.Length; i++)
            {
                double d = Math.Abs(diffPoints[i].Y / range);
                if (d < threshold)
                {
                    diffPoints[i] = new DPoint(diffPoints[i].X, 0);
                }
            }
        }
示例#2
0
 public void Add(DPoint point)
 {
     points.Add(point);
 }
 /// <summary>
 /// Using Excel:
 /// y = -0.3485x2 + 2.8758x + 1.0909
 /// R2 = 0.9564
 /// Sum(y) = 41
 /// </summary>
 DPoint[] testData1()
 {
     DPoint[] testData = new DPoint[]{
         new DPoint(0,1),
         new DPoint(1,3),
         new DPoint(2,6),
         new DPoint(3,7),
         new DPoint(4,8),
         new DPoint(5,6),
         new DPoint(6,5),
         new DPoint(7,4),
         new DPoint(8,2),
         new DPoint(9,-1)};
     return testData;
 }
        /// <summary>
        /// Data from F200 / SMP40 temperature measurements
        /// Exel gives the following formula:
        /// y = -2E-05x2 + 1.0171x - 0.1298
        /// </summary>
        /// <returns></returns>
        DPoint[] realData()
        {
            DPoint[] points = new DPoint[]{
                new DPoint(49.98,50.527d),
                new DPoint(59.98,60.734d),
                new DPoint(69.98,70.938d),
                new DPoint(79.99	,81.12d),
                new DPoint(89.99	,91.288d),
                new DPoint(99.99	,101.451d),
                new DPoint(110	,111.609d),
                new DPoint(119.98	,121.752d),
                new DPoint(129.99	,131.88d),
                new DPoint(139.98	,142.008d),
                new DPoint(149.99	,152.14d),
                new DPoint(159.99	,162.253d),
                new DPoint(169.99	,172.361d),
                new DPoint(179.99	,182.474d),
                new DPoint(190	,192.591d),
                new DPoint(199.99	,202.686d),
                new DPoint(209.99	,212.796d),
                new DPoint(219.99	,222.898d),
                new DPoint(229.99	,233.01d),
                new DPoint(239.99	,243.097d),
                new DPoint(249.99	,253.199d),
                new DPoint(259.99	,263.276d),
                new DPoint(270	,273.357d),
                new DPoint(279.99	,283.424d),
                new DPoint(289.98	,293.484d),
                new DPoint(300	,303.556d),
                new DPoint(310	,313.63d),
                new DPoint(319.99	,323.689d),
                new DPoint(330	,333.758d),
                new DPoint(340	,343.827d),
                new DPoint(349.98	,353.888d),
                new DPoint(359.99	,363.98d),
                new DPoint(370	,374.092d),
                new DPoint(379.98	,384.186d),
                new DPoint(390	,394.349d),
                new DPoint(399.99	,404.49d)};

            return points;
        }
 public void Add(DPoint point)
 {
     Add(point.X, point.Y);
 }
示例#6
0
 public void Add(DPoint point)
 {
     Add(point.X, point.Y);
 }
 public TurningPoint(DPoint point, bool isPeak, int index)
 {
     this.Point  = point;
     this.IsPeak = isPeak;
     this.Index  = index;
 }
 DPoint[] createPoints()
 {
     DPoint[] points = new DPoint[1000];
     int index = 0;
     for (int i = 0; i < 5; i++)
     {
         for (int j = 0; j < 100; j++)
         {
             points[index] = new DPoint(index, j);
             index++;
         }
         for (int j = 0; j < 100; j++)
         {
             points[index] = new DPoint(index, 100-j);
             index++;
         }
     }
     return points;
 }
 public StationaryPoints(DPoint[] points, DPoint[] diffPoints)
 {
     this.points = points;
     this.diffPoints = diffPoints;
 }
 public StationaryPoints(DPoint[] points)
 {
     this.points = points;
     this.diffPoints = new Differentiator(points).Differentiate();
 }
 public TurningPoint(DPoint point, bool isPeak, int index)
 {
     this.Point = point;
     this.IsPeak = isPeak;
     this.Index = index;
 }
 void smoothDiffPoints()
 {
     if (threshold == 0d)
     {
         //no smoothing required
         return;
     }
     double yMin = diffPoints.Min(s => s.Y);
     double range = diffPoints.Max(s => s.Y) - yMin;
     for (int i = 0; i < diffPoints.Length; i++)
     {
         double d = Math.Abs(diffPoints[i].Y / range);
         if (d < threshold)
         {
             diffPoints[i] = new DPoint(diffPoints[i].X, 0);
         }
     }
 }