private void button6_Click(object sender, EventArgs e)//圆柱体半径r相关计算 { Calculate.ExcelToString(path, 1, 10, 5, true); Calculate.StringToDouble(temp); Calculate.Avgn(Convert1, 2); double Avg = Calculate.AvgDouble(Convert1); //求平均值 Cal[15] = Avg; //将半径r的平均值保留到Cal数组中,以便后面计算 textBox1.Text = Convert.ToString(Calculate.A(Avg, 2)); double Axiangdui1 = Calculate.Axiangdui(Convert1);//求A类不确定度 textBox2.Text = Convert.ToString(Calculate.A(Axiangdui1, 2)); double Bxiangdui1 = Calculate.Bxiangdui(0.02);//求B类不确定度 textBox3.Text = Convert.ToString(Calculate.A(Bxiangdui1, 2)); double Zongbuqueding1 = Calculate.Zongbuqueding(Axiangdui1, Bxiangdui1);//求总不确定度 textBox4.Text = Convert.ToString(Calculate.A(Zongbuqueding1, 2)); double Xiangduibuqueding = Calculate.Xiangduibuqueding1(Zongbuqueding1, Avg); //求相对不确定度 textBox5.Text = Convert.ToString(Calculate.A(Xiangduibuqueding, 2)) + "%"; fiveData[4] = 4; }
public void button2_Click(object sender, EventArgs e) //周期T相关计算 { Calculate.ExcelToString(path, 1, 4, 2, false); //读取对应数据,保存到公共变量中,后面同理 Calculate.StringToDouble(temp); //将读取的string数组进行转换,后面同理 Calculate.Avgn(Convert1, 20); //求平均值 double Avg = Calculate.AvgDouble(Convert1); Cal[8] = Avg;//将周期T的平均值保留到Cal数组中,以便后面计算 textBox1.Text = Convert.ToString(Calculate.A(Avg, 3)); double Axiangdui1 = Calculate.Axiangdui(Convert1);//求A类不确定度 textBox2.Text = Convert.ToString(Calculate.A(Axiangdui1, 3)); double Bxiangdui1 = Calculate.Bxiangdui(0.002);//求B类不确定度 textBox3.Text = Convert.ToString(Calculate.A(Bxiangdui1, 3)); double Zongbuqueding1 = Calculate.Zongbuqueding(Axiangdui1, Bxiangdui1); //求总不确定度 Cal[9] = Zongbuqueding1; //将周期T的总不确定度保留到Cal数组中,以便后面计算 textBox4.Text = Convert.ToString(Calculate.A(Zongbuqueding1, 3)); double Xiangduibuqueding = Calculate.Xiangduibuqueding1(Zongbuqueding1, Avg); //求相对不确定度 textBox5.Text = Convert.ToString(Calculate.A(Xiangduibuqueding, 2)) + "%"; fiveData[0] = 0;//定义一个新数组,用来控制后面暂时计算不了的计算按钮失效或者激活,后面同理 }
private void button15_Click(object sender, EventArgs e) //验证平行轴定理 { Cal[11] = Convert.ToDouble(Calculate.ExcelToString(path, 1, 25, 2)); //下圆盘直径 Cal[12] = Convert.ToDouble(Calculate.ExcelToString(path, 1, 26, 2)); //下圆盘质量 Cal[13] = Convert.ToDouble(Calculate.ExcelToString(path, 1, 27, 2)); //圆柱体质量 //计算转动惯量理论值 Calculate.ExcelToString(path, 1, 22, 2, false); Calculate.StringToDouble(temp); Calculate.Itheory(Cal[13], Cal[15], Convert1); //计算转动惯量实验值 Calculate.ExcelToString(path, 1, 23, 2, false); Calculate.StringToDouble(temp); Calculate.Ireality(Cal, Convert1); //计算百分误差 Calculate.Ibaifenwucha(iTheoryOutput, iRealityOutput); //激活对应按钮控件 button9.Enabled = true; button10.Enabled = true; button11.Enabled = true; button12.Enabled = true; button13.Enabled = true; button14.Enabled = true; }