水文分析与计算——代表性分析(滑动平均法)

来源:互联网 发布:淘宝网.连衣裙 编辑:程序博客网 时间:2024/05/18 01:01
//代表性分析.h//滑动平均值法const int M  =4,//NumM[M] = {3, 5, 7, 9};//NumM[i]年滑动平均法double HPMaxYearW;void DaiBiaoFenXi(){using namespace std;ofstream outfile;outfile.open("outfile_YearW_HP.txt");for(int k = 0; k < J; k++){outfile<<setw(10)<<"年份"<<setw(7)<<"最大"<<NumJ[k]<<"日";for(int n = 0; n < M; n++)outfile<<setw(3)<<NumM[n]<<"年滑动平均";outfile<<endl;for(int i = 0; i <  Y; i++){outfile<<setw(10)<<i+StartYear<<setw(10)<<MaxYearW[i][k];for(int n = 0; n < M; n++){if((i < ((NumM[n] - 1)/2)) || (i > (Y - (NumM[n] + 1)/2)))HPMaxYearW = MaxYearW[i][k];else{HPMaxYearW = 0;for(int j = i - (NumM[n] - 1)/2; j <= (i + (NumM[n] - 1)/2); j++)HPMaxYearW += MaxYearW[j][k];HPMaxYearW /= NumM[n];}outfile<<setw(13)<<HPMaxYearW;}outfile<<endl;}outfile<<endl<<endl<<endl;}}

原创粉丝点击