public DataTable LinePredict(DataTable dt, int DateLong) { /*输入数组*/ int n = 1; double[] indata = new double[dt.Rows.Count - DateLong]; for (int i = 0; i < dt.Rows.Count - DateLong; i++) { indata[i] = Convert.ToDouble(dt.Rows[i][0]); } if (dt.Rows.Count - DateLong <= 3) { n = dt.Rows.Count - DateLong - 1; } else { n = 3; } clsARMA am = new clsARMA(indata, n, 10, -10, n, 10, -10, 1000, 100, 0.7, 0.3, DateLong); ArrayList lastData = am.toARMA(); //double maxvar = (double)lastData[0]; //double maxvma = (double)lastData[1]; /*输出数组*/ double[] outdata = (double[])lastData[2]; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][1].ToString().Length == 6) { dt.Rows[i][1] = dt.Rows[i][1].ToString().Replace("-", "-0"); } dt.Rows[i][2] = outdata[i]; } return(dt); }
public DataTable LinePredict(DataTable dt,int DateLong) { /*输入数组*/ int n = 1; double[] indata = new double[dt.Rows.Count - DateLong]; for (int i = 0; i < dt.Rows.Count - DateLong; i++) { indata[i] = Convert.ToDouble(dt.Rows[i][0]); } if (dt.Rows.Count - DateLong <= 3) { n = dt.Rows.Count - DateLong - 1; } else { n = 3; } clsARMA am = new clsARMA(indata, n, 10, -10, n, 10, -10, 1000, 100, 0.7, 0.3, DateLong); ArrayList lastData=am.toARMA(); //double maxvar = (double)lastData[0]; //double maxvma = (double)lastData[1]; /*输出数组*/ double[] outdata = (double[])lastData[2]; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][1].ToString().Length == 6) { dt.Rows[i][1] = dt.Rows[i][1].ToString().Replace("-","-0"); } dt.Rows[i][2] = outdata[i]; } return dt; }