资源简介
水文频率计算试线法(基于皮尔逊-Ⅲ分布)
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using ZedGraph;
//using Microsoft.Office.Interop.Excel;
//using System.Diagnostics;
namespace pearson3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double cv = 0;
double avg = 0;
private void button1_Click(object sender EventArgs e)
{
openFileDialog1.Filter = “样本文件(*.txt)|*.txt|All files (*.*)|*.*“;
openFileDialog1.Multiselect = false;
if (openFileDialog1.ShowDialog() != DialogResult.Cancel)
{
string filePath = openFileDialog1.FileName;
if (!System.IO.File.Exists(filePath))
{
MessageBox.Show(“Topological file does not exist!“);
return;
}
textBox1.Text = filePath;
}
}
private void button2_Click(object sender EventArgs e)
{
if (string.IsNullOrEmpty(textBox1.Text))
{
MessageBox.Show(“未选择文件!“);
return;
}
string[] ReadPlt = File.ReadAllLines(textBox1.Text);
List sample = new List();
for (int i = 0; i < ReadPlt.Length; i++)
{
sample.Add(Convert.ToDouble(ReadPlt[i]));
}
avg = sample.Average();
textBox2.Text = Convert.ToString(avg);
sample.Sort();
double[] ki = new double[sample.Count];
List tempk = new List();
for (int i = 0; i < ki.Length; i++)
{
ki[i] = sample[i] / avg;
tempk.Add((ki[i] - 1) * (ki[i] - 1));
}
cv = Math.Sqrt(tempk.Sum() / (tempk.Count - 1));
textBox3.Text = Convert.ToString(cv);
}
private void button3_Click(object sender EventArgs e)
{
if (textBox4.Text.Length == 0)
{
MessageBox.Show(“请输入合适的Cs值!“);
return;
}
double cs = Convert.ToDouble(textBox4.Text.Trim());
string[] ReadPlt = File.ReadAllLines(@“D:\用户目录\我的文档\Visual Studio 2010\Projects\pearson3\fai.txt“);
double[] xp = new double[ReadPlt.Length - 1];
string[] Cs = ReadPlt[0].Replace(“ “ “@“).Split(‘@‘);
if (cs > Convert.ToDouble(Cs[Cs.Length - 1].Trim()))
{
MessageBox.Show(“Cs超出φ值表,请补充φ值表或重新输入合适的Cs值!“);
return;
}
for (int i = 2; i < Cs.Length; i++)
{
double temp0 = Convert.ToDouble(Cs[i - 1].Tri
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-06-03 10:57 pearson3\
文件 6182 2015-06-02 16:48 pearson3\fai.txt
文件 167 2015-06-02 16:44 pearson3\input.txt
目录 0 2015-06-01 10:19 pearson3\pearson3\
文件 866 2015-06-01 10:17 pearson3\pearson3.sln
文件 22016 2015-06-02 17:41 pearson3\pearson3.suo
目录 0 2015-06-01 10:17 pearson3\pearson3\bin\
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\de\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\de\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\es\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\es\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\fr\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\fr\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\hu\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\hu\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\it\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\it\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\ja\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\ja\ZedGraph.resources.dll
文件 1048576 2002-09-06 12:52 pearson3\pearson3\bin\Debug\Microsoft.Office.Interop.Excel.dll
文件 13312 2015-06-02 16:58 pearson3\pearson3\bin\Debug\pearson3.exe
文件 28160 2015-06-02 16:58 pearson3\pearson3\bin\Debug\pearson3.pdb
文件 11600 2015-06-02 17:41 pearson3\pearson3\bin\Debug\pearson3.vshost.exe
文件 490 2010-03-17 22:39 pearson3\pearson3\bin\Debug\pearson3.vshost.exe.manifest
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\pt\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\pt\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\ru\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\ru\ZedGraph.resources.dll
目录 0 2015-06-02 16:44 pearson3\pearson3\bin\Debug\sk\
文件 4608 2008-12-12 16:01 pearson3\pearson3\bin\Debug\sk\ZedGraph.resources.dll
............此处省略34个文件信息
- 上一篇:道格拉斯算法
- 下一篇:C#读取RS232串口扫描枪
评论
共有 条评论