水文分析与计算——频率分析及洪水流量过程
[cpp]//频率分析.h
void PinLvFenXi()
{
using namespace std;
const int NYear = EndYear - 1862 + 1,//调查考证期(1862-2000)
L = 1,//实测期特大洪水个数
a = 2,//考证期及实测期特大洪水个数
YearSuperYearW[a] = {1903, 1975},//特大洪水年份
SuperYearW[a] = {21000, 12300};//特大洪水值
int order;//降序的序号
double AverageMaxYearW[J] = {0},
HundredYearW[J] = {0},//不同年极值的百年一遇设计值
K,//模比系数
Cv = 0;//变差系数近似无偏估计值
ofstream outfile;
outfile.open("outfile_YearW_P.txt");
outfile<<setw(10)<<"年份"<<setw(10)<<"最大1日"
<<setw(10)<<"降序序号"<<setw(10)<<"经验频率"<<endl;
outfile<<"调查考证期:"<<endl;
for(int M = 0; M < a; M++)//最大1日特大洪水经验频率
outfile<<setw(10)<<YearSuperYearW[M]<<setw(10)<<SuperYearW[M]
<<setw(10)<<M+1<<setw(10)<<(double)(M+1)/(NYear+1)<<endl;
outfile<<"实测期:"<<endl;
for(int i = 0; i < Y; i++)
{//最大1日实测洪水经验频率
for(int M = 0; M < a; M++)
if(StartYear+i == YearSuperYearW[M])
{
outfile<<setw(10)<<YearSuperYearW[M]<<setw(10)<<SuperYearW[M]
<<setw(10)<<"已计入特大洪水"<<endl;
i++;
M = 0;//再检验i++
}
if(i == Y) break;
AverageMaxYearW[0] += MaxYearW[i][0];
outfile<<setw(10)<<StartYear+i<<setw(10)<<MaxYearW[i][0];
order = 1;//从1开始降序排序的(忽略L个特大洪水)
for(int j = 0; j < Y; j++)
if(MaxYearW[i][0]<MaxYearW[j][0]) order++;
outfile<<setw(10)<<order - L<<setw(10)<<(double)(order - L)/(Y+1)<<endl;
}
AverageMaxYearW[0] *= ((NYear - a)/(Y - L));
for(int M = 0; M < a; M++)
AverageMaxYearW[0] += SuperYearW[M];
AverageMaxYearW[0] /= NYear;//得到最大1日洪水的多年平均值
for(int i = 0; i < Y; i++)
{//计算最大1日洪水的变差系数
for(int M = 0; M < a; M++)
if(StartYear+i == YearSuperYearW[M])
{
i++;
M = 0;//再检验i++
}
if(i == Y) break;
Cv += pow(MaxYearW[i][0] - AverageMaxYearW[0], 2);
}
Cv *= ((NYear - a)/(Y - L));
for(int M = 0; M < a; M++)
Cv += pow(SuperYearW[M] - AverageMaxYearW[0], 2);
Cv = pow(Cv/(NYear - 1), 0.5)/AverageMaxYearW[0];
outfile<<endl<<endl<<setw(10)<<"年份";
for(int k = 1; k < J; k++)//其他年极值洪水经验频率
outfile<<setw(7)<<"最大"<<NumJ[k]<<"日"
<<setw(10)<<"降序序号"<<setw(10)<<"经验频率";
outfile<<endl;
for(int i = 0; i < Y; i++)
{//算经验频率
outfile<<setw(10)<<StartYear+i;
for(int k = 1; k < J; k++)
{
outfile<<setw(10)<<MaxYearW[i][k];
order = 1;//从1开始降序排序的
for(int j = 0; j < Y; j++)
if(MaxYearW[i][k]<MaxYearW[j][k]) order++;
outfile<<setw(10)<<order<<setw(10)<<(double)order/(Y+1);
}
outfile<<endl;
}
outfile.close();
for(int k = 1; k < J; k++)
{//算其他年极值的多年平均值
for(int i = 0; i < Y; i++)
AverageMaxYearW[k] += MaxYearW[i][k];
AverageMaxYearW[k] /= Y;
}
cout<<"年极值系列频率分析——理论频率曲线参数初
补充:软件开发 , C++ ,