Beispiel #1
0
        private void bPFilterButton_Click(object sender, EventArgs e)
        {
            try
            {
                int threshold0 = (int)bPFilterNnumericUpDown0.Value;
                int threshold1 = (int)bPFilterNumericUpDown1.Value;

                if (bPFilterComboBox.Text == "Гц")
                {
                    threshold0 = (int)(threshold0 / (signal.Hz / signal.Count));
                    threshold1 = (int)(threshold1 / (signal.Hz / signal.Count));
                }

                FilterType type         = GetFourierTransformType();
                double[]   preparedData = FiltersUtils.PrepareDataToFilter(signal.Data, type);

                var filteredData = FourierTransform.BPFilter(preparedData, threshold0, threshold1, type);

                if (saveToFileCheckBox.Checked)
                {
                    WriteDataToFile(filteredData);
                }

                var form = new ShowChartForm(filteredData, filePath + " полосовой фильтр", signal.Type, signal.Hz);
                form.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }