private void get_FFT_data_byMatlab(string strfile, ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; myPane.Title.Text = "加压信号频域波形"; myPane.XAxis.Title.Text = "频率(kHZ)"; myPane.YAxis.Title.Text = "幅值"; getTandFdataNative.getTandFdata getTandFdata = new getTandFdataNative.getTandFdata(); object resultObj = getTandFdata.readpinyudata(2, strfile); object[] resultObjs = (object[])resultObj; double[,] Ff = (double[, ])resultObjs[0]; double[,] abs_Y8 = (double[, ])resultObjs[1]; zgc.GraphPane.CurveList.Clear(); PointPairList list1 = new PointPairList(); for (int i = 0; Ff[0, i] < 20; i++) { list1.Add(Ff[0, i], abs_Y8[i, 0]); } LineItem mCure = myPane.AddCurve("", list1, Color.Blue, SymbolType.None); zgc.AxisChange(); zgc.Refresh();//重新刷新 }
private void get_time_data_byMatlab(string strfile, ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; myPane.Title.Text = "加压信号时域波形"; myPane.XAxis.Title.Text = "时间(ms)"; myPane.YAxis.Title.Text = "电流(mA)"; getTandFdataNative.getTandFdata getTandFdata = new getTandFdataNative.getTandFdata(); object resultObj = getTandFdata.readtimedata(2, strfile); object[] resultObjs = (object[])resultObj; double[,] time_ms = (double[, ])resultObjs[0]; double[,] time_data = (double[, ])resultObjs[1]; zgc.GraphPane.CurveList.Clear(); PointPairList list1 = new PointPairList(); for (int i = 0; i < 2 * 1024 * 1024 - 10; i++) { list1.Add(time_ms[0, i], time_data[i, 0]); } LineItem mCure = myPane.AddCurve("", list1, Color.Blue, SymbolType.None); zgc.AxisChange(); zgc.Refresh();//重新刷新 }
private void get_Shujuchuli_data_byMatlab(string strfile8, string strfile0, ZedGraphControl zgc, ZedGraphControl zgc0, ZedGraphControl zgc1) { GraphPane myPane = zgc0.GraphPane; GraphPane myPane1 = zgc1.GraphPane; GraphPane myPane_1_3 = zgc.GraphPane; myPane.Title.Text = "信号降噪后时域波形"; myPane.XAxis.Title.Text = "时间(ms)"; myPane.YAxis.Title.Text = "电流(mA)"; myPane1.Title.Text = "信号降噪后频域波形"; myPane1.XAxis.Title.Text = "频率(kHZ)"; myPane1.YAxis.Title.Text = "幅值"; myPane_1_3.Title.Text = "信号降噪后1/3倍频程对数功率谱"; myPane_1_3.XAxis.Title.Text = "频率(kHZ)"; myPane_1_3.YAxis.Title.Text = "幅值"; getTandFdataNative.getTandFdata getTandFdata = new getTandFdataNative.getTandFdata(); object resultObj = getTandFdata.ChuLiShuJu(6, strfile8, strfile0); object[] resultObjs = (object[])resultObj; double[,] time_ms = (double[, ])resultObjs[0]; double[,] time_data = (double[, ])resultObjs[1]; double[,] Ff = (double[, ])resultObjs[2]; double[,] abs_Y8 = (double[, ])resultObjs[3]; double[,] Center_freq = (double[, ])resultObjs[4]; double[,] Yc = (double[, ])resultObjs[5]; zgc0.GraphPane.CurveList.Clear(); PointPairList list1 = new PointPairList(); zgc1.GraphPane.CurveList.Clear(); zgc.GraphPane.CurveList.Clear(); PointPairList list2 = new PointPairList(); PointPairList list3 = new PointPairList(); for (int i = 0; Ff[0, i] < 20; i++) { list1.Add(Ff[0, i], abs_Y8[i, 0]); } for (int i = 0; i < 2 * 1024 * 1024 - 10; i++) { list2.Add(time_ms[0, i], time_data[i, 0]); } for (int i = 0; i < 31; i++) { list3.Add(Center_freq[0, i] / 1000, Yc[0, i]); } Center_freq_for_AN = Center_freq; Yc_for_AN = Yc; LineItem mCure = myPane.AddCurve("", list2, Color.Blue, SymbolType.None); LineItem mCure1 = myPane1.AddCurve("", list1, Color.Blue, SymbolType.None); LineItem mCure_1_3 = myPane_1_3.AddCurve("", list3, Color.Red, SymbolType.Circle); //mCure_1_3.Line.IsVisible = false; zgc0.AxisChange(); zgc0.Refresh(); //重新刷新 zgc1.AxisChange(); zgc1.Refresh(); //重新刷新 zgc.AxisChange(); zgc.Refresh(); //重新刷新 }