Example #1
0
        /// <summary>
        /// 获取结果
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public double GetY(Time time)
        {
            if (LsPolyFit == null)
            {
                throw new Exception("请Init初始化先!");
            }
            double xValue = time - FirstTime;

            return(LsPolyFit.GetY(xValue));
        }
Example #2
0
        /// <summary>
        ///  拟合下一个数据。
        /// </summary>
        /// <param name="nextIndex">下一个编号,0为推1个单位,1为外推2个单位</param>
        /// <param name="order"></param>
        /// <returns></returns>
        public RmsedNumeral GetNextLsPolyFitValue(double nextIndex = 0, int order = 2)
        {
            LsPolyFit fit = GetLsPolyFit(order);

            return(new RmsedNumeral(fit.GetY(this.Count + nextIndex), fit.StdDev));
        }
Example #3
0
        /// <summary>
        /// 多项式拟合。
        /// 参数与乘积为从低到高。
        /// 注意:拟合参数数量 = 阶次 + 1
        /// </summary>
        /// <param name="arrayX">数组</param>
        /// <param name="arrayY">数组</param>
        /// <param name="order">阶次</param>
        /// <returns>拟合参数</returns>
        public static double[] GetFitParams(double[] arrayX, double[] arrayY, int order)
        {
            LsPolyFit fit = new LsPolyFit(arrayX, arrayY, order);

            return(fit.FitParameters());
        }
Example #4
0
 /// <summary>
 /// 字符串显示
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(LsPolyFit.ToString());
 }
Example #5
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     LsPolyFit = new LsPolyFit(this.Order);
     LsPolyFit.InitAndFitParams <double>(DicData, m => m);
 }