예제 #1
0
        private void smooth()
        {
            Presolution pre = new Presolution();

            AuxiliaryFunc.percent = 0;
            pre.DoPresolve(foldname, newfoldname, "S11");
            AuxiliaryFunc.percent = 100; MessageBox.Show("平滑计算完成!");
        }
        private void normal()
        {
            Presolution pre = new Presolution();

            AuxiliaryFunc.percent = 0;
            pre.DoPresolve(foldname, newfoldname, "N");
            AuxiliaryFunc.percent = 100; MessageBox.Show("归一化完成!");
        }
 private void derive()
 {
     if (foldname != "" && newfoldname != "")
     {
         Presolution pre = new Presolution();
         AuxiliaryFunc.percent = 0;
         pre.DoPresolve(foldname, newfoldname, "D");
         AuxiliaryFunc.percent = 100; MessageBox.Show("一阶导计算完成!");
     }
 }
예제 #4
0
        public void Derivation(DataTable ddd, ref DataTable result, bool tt, int K, ref double[,,] p, double Y)//平滑并求导,tt为真则是对土壤库求导,否则是对样本库求导,K为放大倍数,Y为=0的阈值
        {
            Presolution pre  = new Presolution();
            DataTable   temp = new DataTable();

            temp = ddd.Copy();
            pre.Plot5(temp);
            SaveTemp(temp);
            if (tt)
            {
                for (int i = rawStartLine; i < temp.Rows.Count; i++)
                {
                    int TEMP = 0;//计算有多少个极大值点
                    for (int j = rawStart + 6; j < temp.Columns.Count - 5; j++)
                    {
                        //计算曲线各个位置上的一阶导数(用差分代替微分)
                        result.Rows[i][j] = K * (Convert.ToDouble(temp.Rows[i][j]) - Convert.ToDouble(temp.Rows[i][j - 1]));
                        if (Math.Abs(Convert.ToDouble(result.Rows[i][j])) < Y && (Convert.ToDouble(temp.Rows[i][j - 5]) < Convert.ToDouble(temp.Rows[i][j])) && (Convert.ToDouble(temp.Rows[i][j + 5]) < Convert.ToDouble(temp.Rows[i][j])))
                        {
                            p[i, TEMP, 0] = j;
                            p[i, TEMP, 1] = Convert.ToDouble(temp.Rows[i][j]);
                            TEMP++;
                        }
                    }
                    result.Rows[i][rawStart] = 0;//单独给第一个点赋值
                }
            }
            else
            {
                for (int i = exampleStartLine; i < temp.Rows.Count; i++)
                {
                    int TEMP = 0;
                    for (int j = exampleStart; j < temp.Columns.Count; j++)
                    {
                        //计算曲线各个位置上的一阶导数(用差分代替微分并放大)
                        result.Rows[i][j] = K * ((Convert.ToDouble(temp.Rows[i][j]) - Convert.ToDouble(temp.Rows[i][j - 1])));
                        if (Math.Abs(Convert.ToDouble(result.Rows[i][j])) < Y)
                        {
                            p[i, TEMP, 0] = j;
                            p[i, TEMP, 1] = Convert.ToDouble(temp.Rows[i][j]);
                            TEMP++;
                        }
                    }
                    result.Rows[i][exampleStart] = 0;//单独给第一个点赋值
                }
            }
        }