示例#1
0
        private void sample()
        {
            if (freq == 0 || Amp == 0)
            {
                ErrorMessadge em = new ErrorMessadge();
                em.ShowDialog();
            }
            else
            {
                ourmode = mode.other;
                SamplingValues sv = new SamplingValues();
                sv.setlabelandvalues("Частота дискретизації: ", MainForm.freq * 5, MainForm.freq * 100);
                sv.ShowDialog();
                sampling_f = sv.sampling_freq;

                sm = new Sampler(Amp, freq, sampling_f, time);
                sm.Sampling();

                chart1.Series[0].Points.Clear();
                chart1.Series[1].Points.Clear();
                chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StepLine;
                for (int i = 0; i < sm.size; i++)
                {
                    chart1.Series[0].Points.AddXY(sm.x[i], sm.y[i]);
                }
            }
        }
示例#2
0
        private void linear()
        {
            if (sampling_f == 0)
            {
                ErrorMessadge em = new ErrorMessadge();
                em.ShowDialog();
            }
            else
            {
                SamplingValues sv = new SamplingValues();
                sv.setlabelandvalues("Частота передискретизації: ", sampling_f * 2, sampling_f * 20);
                sv.ShowDialog();
                linterp_f = sv.sampling_freq;

                ourmode = mode.linear;
                //ln = new LinearInterpolator();
                //ln.setup(sm.x, sm.y, sampling_f, sampling_f, time);
                //ln.interpolation();
                chart1.Series[0].Points.Clear();
                chart1.Series[1].Points.Clear();
                chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series[1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StepLine;
                //for (int i = 0; i < ln.size - 4; i++)
                //    chart1.Series[0].Points.AddXY(ln.resX[i] + ln.step * 2, ln.resY[i]);
                for (int i = 0; i < sm.size - 4; i++)
                {
                    chart1.Series[1].Points.AddXY(sm.x[i], sm.y[i]);
                }
            }
        }
示例#3
0
        private void bspline()
        {
            if (sampling_f == 0)
            {
                ErrorMessadge em = new ErrorMessadge();
                em.ShowDialog();
            }
            else
            {
                SamplingValues sv = new SamplingValues();
                sv.setlabelandvalues("Частота передискретизації: ", sampling_f * 2, sampling_f * 20);
                sv.ShowDialog();
                binterp_f = sv.sampling_freq;

                ourmode = mode.bspline;
                bs      = new BsplineInterpolator();
                bs.setup(sm.x, sm.y, sampling_f, sampling_f, time);
                bs.interpolation();
                chart1.Series[0].Points.Clear();
                chart1.Series[1].Points.Clear();
                chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
                chart1.Series[1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StepLine;
                for (int i = 0; i < bs.size - 7; i++)
                {
                    chart1.Series[0].Points.AddXY(bs.resX[i] + bs.step * 5, bs.resY[i]);
                }
                for (int i = 0; i < sm.size - 4; i++)
                {
                    chart1.Series[1].Points.AddXY(sm.x[i], sm.y[i]);
                }

                trackBar2.Visible = true;
                trackBar2.Enabled = true;
            }
        }