private void button1_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 2; progressBar1.Value = 0; textBox1.Text = "FFT testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // mcore.Types.Collection fft_col = new mcore.Types.Collection(2); double power = 0; double t0 = 0.001; double sinus_freq = 100; for (int i = 0; i < 10000; i++) { fft_col.Add(0, System.Math.Sin(2.0 * Math.PI * sinus_freq * i * t0)); fft_col.Add(1, 0); } mcore.Math.FFT(fft_col, ref power); mcore.Types.Collection fft_draw = new mcore.Types.Collection(2); int DataCount = (int)System.Math.Pow(2.0, power); double WorkFreq = 1.0 / t0; double minFreq = 1; double maxFreq = WorkFreq / 2; for (int i = 0; i < DataCount / 2; i++) { double xVal = i / (double)DataCount * WorkFreq; if (xVal >= minFreq && xVal < maxFreq) { double yVal = System.Math.Sqrt(fft_col[0][i] * fft_col[0][i] + fft_col[1][i] * fft_col[1][i]) * 2.0 / (double)DataCount; fft_draw.Add(0, xVal); fft_draw.Add(1, yVal); } } chart1.Series[0].Points.DataBindXY(fft_draw[0], fft_draw[1]); chart1.Series[0].BorderWidth = 2; chart1.ChartAreas[0].AxisX.IsLogarithmic = true; chart1.ChartAreas[0].AxisY.IsLogarithmic = true; // textBox1.Text += "FFT testing - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; //isBreak = true; }
private void button_Matrix_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 1; textBox1.Text = "Matix testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; mcore.Types.Collection collection = new mcore.Types.Collection(2); // local test double [] in_array = { 1, 2, 1, 4, 1, 6, 1, 2, 3 }; mcore.Types.Matrix m1 = new mcore.Types.Matrix(3, 3, in_array); mcore.Types.Matrix m2 = new mcore.Types.Matrix(m1); mcore.Types.Matrix m3 = m1 + m2; mcore.Types.Matrix m4 = (m1 + m2) * (m1 + m2); mcore.Types.Matrix m5 = ((m1 + m2) * (m1 + m2)).Inverse(); mcore.Types.Matrix m6 = m4 * m5; textBox1.Text += "m3 = m1 + m2" + System.Environment.NewLine; textBox1.Text += m3.ToString() + System.Environment.NewLine; textBox1.Text += "m4 = (m1+m2)*(m1+m2)" + System.Environment.NewLine; textBox1.Text += m4.ToString() + System.Environment.NewLine; textBox1.Text += "m5 = ((m1+m2)*(m1+m2)).Inverse()" + System.Environment.NewLine; textBox1.Text += m5.ToString() + System.Environment.NewLine; textBox1.Text += "m6 = m4 * m5" + System.Environment.NewLine; textBox1.Text += m6.ToString() + System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; // textBox1.Text += "Matrix testing - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; }
private void button_AllanVariance_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 2; progressBar1.Value = 0; textBox1.Text = "Allan Variance testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // isBreak = false; mcore.Types.Collection collection = new mcore.Types.Collection("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); mcore.Types.Collection dd = mcore.Math.AllanVariance(0.1, collection, ref isBreak, progressBar1); //double[] x = new double[]{0.1, 1, 2, 3, 4, 5, 7, 8, 9, 10}; //double[] y = new double[]{0.1, 0.2, 0.3, 0.04, 5, 0.06, .07, 0.8, 0.9, 0.10}; //chart1.Series[0].Points.DataBindXY(x, y); // chart1.Series[0].Points.DataBindXY(dd[0], dd[1]); //chart1.Series[0].Points.DataBindY(dd[0]); chart1.ChartAreas[0].AxisX.IsLogarithmic = true; chart1.ChartAreas[0].AxisY.IsLogarithmic = true; textBox1.Text += "Allan Variance calculation - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; }
private void button_Collection_Click(object sender, EventArgs e) { Init_Chart(chart1); textBox1.Clear(); tabControl1.SelectedIndex = 2; textBox1.Text = "Collection testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; mcore.Types.Collection collection = new mcore.Types.Collection(2); // local test collection.set_VectorName(0, "test1"); collection.set_VectorName(1, "test2"); collection.set_VectorVisibility(1, false); collection.Add(0, 1); collection.Add(1, 11); collection.Add(0, 2); collection.Add(1, 22); collection.Add(0, 3); collection.Add(1, 33); collection.Add(0, 4); collection.Add(1, 44); // file load collection.Load_TextFile("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); collection.Save_TextFile("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(002)_s_pr1__.txt", null); chart1.Series[0].Points.DataBindY(collection[0]); textBox1.Text += "Collection - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; }
private void button_Filtration_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 2; progressBar1.Value = 0; textBox1.Text = "Filtration testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // int filtertype = 1; mcore.Digital filter; switch (filtertype) { case 1: filter = new mcore.Digital.filter_loPass(0.001, 100, 1); break; case 2: filter = new mcore.Digital.filter_hiPass(0.001, 100, 1); break; case 3: filter = new mcore.Digital.filter_bandStop(0.001, 50, 50); break; case 4: filter = new mcore.Digital.filter_bandPass(0.001, 50, 5); break; case 5: filter = new mcore.Digital.phase_Corrector(0.001, 100); break; default: filter = null; break; } mcore.Types.Collection c = mcore.Math.Frequency_responce(1, 1000, 0.001, filter.coefs); for (int i = 0; i < filter.coefs[0].Count; i++) { textBox1.Text += "a" + i.ToString() + " = " + filter.coefs[0][i] + System.Environment.NewLine; } textBox1.Text += System.Environment.NewLine; for (int i = 0; i < filter.coefs[1].Count; i++) { textBox1.Text += "b" + i.ToString() + " = " + filter.coefs[1][i] + System.Environment.NewLine; } chart1.Series[0].Points.DataBindXY(c[0], c[1]); chart1.Series[1].Points.DataBindXY(c[0], c[2]); chart1.ChartAreas[0].AxisX.IsLogarithmic = true; chart1.ChartAreas[0].AxisX.Minimum = c.Vectors[0].Minimum; chart1.ChartAreas[0].AxisX.Maximum = c.Vectors[0].Maximum; // textBox1.Text += "Filtration testing - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; //isBreak = true; }
private void button_Regression_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 1; textBox1.Text = "Regression testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // mcore.Types.Collection collection = new mcore.Types.Collection("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); mcore.Types.Collection c1 = collection.get_SubCollection(new int[] { 0 }); mcore.Types.Collection c2 = collection.get_SubCollection(new int[] { 1, 2, 3, 4 }); int [] power_array = new int[] { 0, 1, 2, 3, 4 }; double [][] res = mcore.Math.Regression(c1, c2, power_array); // Вывод результата (коэффициенты) for (int i = 0; i < c2.VectorsCount; i++) { textBox1.Text += System.Environment.NewLine + " vector" + i.ToString() + " = "; for (int k = 0; k < power_array.Length; k++) { textBox1.Text += res[i][k].ToString("f9") + "\t"; } } textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; // Графическое представление коррекции List <double> correctionResult = new List <double>(); List <double> correctionResult_error = new List <double>(); for (int i = 0; i < c1[0].Count; i++) { double value = 0; for (int k = 0; k < c2.VectorsCount; k++) { for (int z = 0; z < power_array.Length; z++) { value += res[k][z] * Math.Pow(c2[k][i], power_array[z]); } } correctionResult.Add(value); correctionResult_error.Add((c1[0][i] - value) / 0.035 * 3600.0); } chart1.Series[0].Points.DataBindY(c1[0]); chart1.Series[1].Points.DataBindY(correctionResult); chart1.Series[5].Points.DataBindY(correctionResult_error); chart1.ChartAreas[1].Visible = true; // textBox1.Text += "Regression - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1) * 0.001).ToString() + " sec"; }
public static Types.Collection AllanVariance(double t0, mcore.Types.Collection input, ref bool isBreak, System.Windows.Forms.ProgressBar pb) { Types.Collection Result_Array = new Types.Collection(2); Types.Collection CurrData = new Types.Collection(); double invert_sqrt_2 = 1.0 / System.Math.Sqrt(2.0); int input_ValsCount = input[0].Count; int CountAllanPoint = input[0].Count / 10; int SumCounter; double CurrentSum; if (pb != null) { pb.Value = 0; pb.Maximum = CountAllanPoint; } for (int i = 0; i < CountAllanPoint; i++) { CurrData.Clear(); // --------- double OldSum = 0; for (int k = 0; k < input_ValsCount; k = k + (i + 1)) { SumCounter = 0; CurrentSum = 0; for (int z = k; z < k + (i + 1); z++) { if (z <= input_ValsCount - 1) { CurrentSum = CurrentSum + input[0][z]; SumCounter++; } } CurrentSum = CurrentSum / (float)SumCounter; // ---------- Разность соседних сумм ----- if (k > 0) { CurrData.Add(CurrentSum - OldSum); } // ---------- OldSum = CurrentSum; } double Mean = CurrData.Vectors[0].get_Mean(); double SCO = CurrData.Vectors[0].get_SCO(0, CurrData[0].Count, Mean) * invert_sqrt_2; Result_Array.Add(0, t0 * (i + 1)); Result_Array.Add(1, SCO); if (pb != null) { pb.Value = i; } System.Windows.Forms.Application.DoEvents(); if (isBreak == true) { return(Result_Array); } } return(Result_Array); }
/// <summary> /// Расчет АЧХ/ФЧХ, по входному полиному (X/Y) /// </summary> /// <param name="begin_decad">Целое число - начальная декада</param> /// <param name="end_decad">Целое число - конечная декада</param> /// <param name="in_num_denum">Входной масив данных, вектор "0" - числитель полинома, вектор "1" - знаменатель полинома</param> /// <returns>Результат вычилений, вектор "0" - частота, вектор "1" - АЧХ, вектор "2" - ФЧХ</returns> public static mcore.Types.Collection Frequency_responce(double begin_freq, double end_freq, double t0, mcore.Types.Collection in_num_denum) { if (in_num_denum == null) { return(null); } mcore.Types.Collection result = new Types.Collection(3); // preparing frequency list double b_decad = System.Math.Floor(System.Math.Log(begin_freq + 0.0001) / System.Math.Log(10)); double e_decad = System.Math.Floor(System.Math.Log(end_freq + 0.0001) / System.Math.Log(10)); int count_decad = Convert.ToInt32(e_decad - b_decad); int screen_width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; double count_points_inOneDecad = screen_width / count_decad; double freq_offset = 1e-6; // ------ Frequency List ------------ for (int n = 0; n < count_decad; n++) { for (int k = 0; k < count_points_inOneDecad + 1; k++) { result.Add(0, System.Math.Pow(10, (k / count_points_inOneDecad) + n + b_decad)); } } int vector_legth = result.Vectors[0].data.Count; int num_length = in_num_denum.Vectors[0].data.Count; int denum_length = in_num_denum.Vectors[1].data.Count; for (int i = 0; i < vector_legth; i++) { double freq = result[0][i] + freq_offset; double Re1 = 0.0; double Im1 = 0.0; double Re2 = 0.0; double Im2 = 0.0; //double aOmega = 2 / T0 * Math::ArcTan2(T0 * aLambda, 2); double aOmega = freq; for (int k = 0; k < num_length; k++) { double value = in_num_denum[0][k]; Re1 += value * System.Math.Cos(k * aOmega * t0 * 2 * System.Math.PI); Im1 -= value * System.Math.Sin(k * aOmega * t0 * 2 * System.Math.PI); } for (int k = 0; k < denum_length; k++) { double value = in_num_denum[1][k]; Re2 += value * System.Math.Cos(k * aOmega * t0 * 2 * System.Math.PI); Im2 -= value * System.Math.Sin(k * aOmega * t0 * 2 * System.Math.PI); } double val1; double val2; try { val1 = 20.0 * System.Math.Log10(System.Math.Sqrt(Re1 * Re1 + Im1 * Im1) / System.Math.Sqrt(Re2 * Re2 + Im2 * Im2)); val2 = System.Math.Atan2(Im1, Re1) - System.Math.Atan2(Im2, Re2); } catch { val1 = 0.0; val2 = 0.0; } result.Add(1, val1); result.Add(2, val2 * 180.0 / System.Math.PI); } return(result); }
/// <summary> /// Считает коэфициенты регрессии для "У" набором данных "Х" /// </summary> /// <param name="x">Набор данных Х</param> /// <param name="y">К чему стремимся</param> /// <param name="power">Степенной ряд, для которого делаем счет</param> /// <returns></returns> public static double [][] Regression(mcore.Types.Collection y, mcore.Types.Collection x, int[] powers) { if (x == null) { throw new Exception("(x) is null"); } if (y == null) { throw new Exception("(y) is null"); } if (powers == null) { throw new Exception("(powers) is null"); } if (powers.Length >= y[0].Count) { throw new Exception("Length is small"); } int ValuesCount = y[0].Count; int xParamCount = x.VectorsCount; int PolinomLevel = powers.Length; double [][] result = new double[xParamCount][]; for (int i = 0; i < xParamCount; i++) { result[i] = new double[PolinomLevel]; } mcore.Types.Matrix XMat = new mcore.Types.Matrix(ValuesCount, PolinomLevel * xParamCount); mcore.Types.Matrix YMat = new mcore.Types.Matrix(ValuesCount, 1); mcore.Types.Matrix K = new Types.Matrix(); for (int i = 0; i < ValuesCount; i++) { YMat[i][0] = y[0][i]; } for (int i = 0; i < ValuesCount; i++) { for (int z = 0; z < xParamCount; z++) { for (int k = 0; k < PolinomLevel; k++) { XMat[i][k + z * (PolinomLevel)] = System.Math.Pow(x[z][i], powers[k]); } } } K = (XMat.Transpose() * XMat).Inverse() * XMat.Transpose() * YMat; // ---------- K.Rows for (int i = 0; i < xParamCount; i++) { for (int k = 0; k < PolinomLevel; k++) { result[i][k] = K[k + i * PolinomLevel][0]; } } return(result); }
private void button1_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 2; progressBar1.Value = 0; textBox1.Text = "FFT testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // mcore.Types.Collection fft_col = new mcore.Types.Collection(2); double power = 0; double t0 = 0.001; double sinus_freq = 100; for ( int i = 0; i < 10000; i++) { fft_col.Add(0, System.Math.Sin(2.0 * Math.PI * sinus_freq * i * t0 )); fft_col.Add(1, 0); } mcore.Math.FFT(fft_col, ref power); mcore.Types.Collection fft_draw = new mcore.Types.Collection(2); int DataCount = (int)System.Math.Pow(2.0, power); double WorkFreq = 1.0 / t0; double minFreq = 1; double maxFreq = WorkFreq / 2; for ( int i = 0; i < DataCount / 2; i++) { double xVal = i / (double)DataCount * WorkFreq; if ( xVal >= minFreq && xVal < maxFreq ) { double yVal = System.Math.Sqrt(fft_col[0][i]*fft_col[0][i] + fft_col[1][i]*fft_col[1][i])*2.0 / (double)DataCount; fft_draw.Add(0, xVal); fft_draw.Add(1, yVal); } } chart1.Series[0].Points.DataBindXY(fft_draw[0], fft_draw[1]); chart1.Series[0].BorderWidth = 2; chart1.ChartAreas[0].AxisX.IsLogarithmic = true; chart1.ChartAreas[0].AxisY.IsLogarithmic = true; // textBox1.Text += "FFT testing - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1)*0.001).ToString() + " sec"; //isBreak = true; }
private void button_Regression_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 1; textBox1.Text = "Regression testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // mcore.Types.Collection collection = new mcore.Types.Collection("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); mcore.Types.Collection c1 = collection.get_SubCollection(new int[]{0}); mcore.Types.Collection c2 = collection.get_SubCollection(new int[]{1, 2, 3, 4}); int []power_array = new int[]{0, 1, 2, 3, 4}; double [][]res = mcore.Math.Regression(c1, c2, power_array); // Вывод результата (коэффициенты) for ( int i = 0 ; i < c2.VectorsCount; i++) { textBox1.Text += System.Environment.NewLine + " vector" + i.ToString() + " = "; for ( int k = 0; k < power_array.Length; k++ ) textBox1.Text += res[i][k].ToString("f9") + "\t"; } textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; // Графическое представление коррекции List<double> correctionResult = new List<double>(); List<double> correctionResult_error = new List<double>(); for ( int i = 0; i < c1[0].Count; i++) { double value = 0; for ( int k = 0; k < c2.VectorsCount; k++) for ( int z = 0; z < power_array.Length; z++ ) { value += res[k][z] * Math.Pow( c2[k][i] , power_array[z]); } correctionResult.Add(value); correctionResult_error.Add((c1[0][i] - value)/0.035*3600.0); } chart1.Series[0].Points.DataBindY(c1[0]); chart1.Series[1].Points.DataBindY(correctionResult); chart1.Series[5].Points.DataBindY(correctionResult_error); chart1.ChartAreas[1].Visible = true; // textBox1.Text += "Regression - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1)*0.001).ToString() + " sec"; }
private void button_Matrix_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 1; textBox1.Text = "Matix testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; mcore.Types.Collection collection = new mcore.Types.Collection(2); // local test double []in_array = {1, 2, 1, 4, 1, 6, 1, 2, 3}; mcore.Types.Matrix m1 = new mcore.Types.Matrix(3, 3, in_array); mcore.Types.Matrix m2 = new mcore.Types.Matrix(m1); mcore.Types.Matrix m3 = m1+m2; mcore.Types.Matrix m4 = (m1+m2)*(m1+m2); mcore.Types.Matrix m5 = ((m1+m2)*(m1+m2)).Inverse(); mcore.Types.Matrix m6 = m4*m5; textBox1.Text += "m3 = m1 + m2" + System.Environment.NewLine; textBox1.Text += m3.ToString() + System.Environment.NewLine; textBox1.Text += "m4 = (m1+m2)*(m1+m2)" + System.Environment.NewLine; textBox1.Text += m4.ToString() + System.Environment.NewLine; textBox1.Text += "m5 = ((m1+m2)*(m1+m2)).Inverse()" + System.Environment.NewLine; textBox1.Text += m5.ToString() + System.Environment.NewLine; textBox1.Text += "m6 = m4 * m5" + System.Environment.NewLine; textBox1.Text += m6.ToString() + System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; // textBox1.Text += "Matrix testing - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1)*0.001).ToString() + " sec"; }
private void button_Collection_Click(object sender, EventArgs e) { Init_Chart(chart1); textBox1.Clear(); tabControl1.SelectedIndex = 2; textBox1.Text = "Collection testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; mcore.Types.Collection collection = new mcore.Types.Collection(2); // local test collection.set_VectorName(0, "test1"); collection.set_VectorName(1, "test2"); collection.set_VectorVisibility(1, false); collection.Add(0, 1); collection.Add(1, 11); collection.Add(0, 2); collection.Add(1, 22); collection.Add(0, 3); collection.Add(1, 33); collection.Add(0, 4); collection.Add(1, 44); // file load collection.Load_TextFile("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); collection.Save_TextFile("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(002)_s_pr1__.txt", null); chart1.Series[0].Points.DataBindY(collection[0]); textBox1.Text += "Collection - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1)*0.001).ToString() + " sec"; }
private void button_AllanVariance_Click(object sender, EventArgs e) { textBox1.Clear(); Init_Chart(chart1); tabControl1.SelectedIndex = 2; progressBar1.Value = 0; textBox1.Text = "Allan Variance testing"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; int t1 = System.Environment.TickCount; System.Windows.Forms.Application.DoEvents(); // isBreak = false; mcore.Types.Collection collection = new mcore.Types.Collection("E:\\.PersonalProjects\\CSharp\\.Library\\.Data\\01-0078_(810).exp(001)_s_pr1.txt", null); mcore.Types.Collection dd = mcore.Math.AllanVariance( 0.1, collection, ref isBreak, progressBar1 ); //double[] x = new double[]{0.1, 1, 2, 3, 4, 5, 7, 8, 9, 10}; //double[] y = new double[]{0.1, 0.2, 0.3, 0.04, 5, 0.06, .07, 0.8, 0.9, 0.10}; //chart1.Series[0].Points.DataBindXY(x, y); // chart1.Series[0].Points.DataBindXY(dd[0], dd[1]); //chart1.Series[0].Points.DataBindY(dd[0]); chart1.ChartAreas[0].AxisX.IsLogarithmic = true; chart1.ChartAreas[0].AxisY.IsLogarithmic = true; textBox1.Text += "Allan Variance calculation - done"; textBox1.Text += System.Environment.NewLine; textBox1.Text += System.Environment.NewLine; textBox1.Text += "Time elapsed = " + ((System.Environment.TickCount - t1)*0.001).ToString() + " sec"; }