private void showImpulceCharacteristicButton_Click(object sender, EventArgs e) { try { int n = (int)impulceCharacteristicNNumericUpDown.Value; double threshold = (double)impulceCharacteristicThresholdNumericUpDown.Value; var windowType = GetFourierTransformType(); var impCharType = (FirFilterType)Enum.Parse(typeof(FirFilterType), (string)impulseCharacteristicTypeComboBox.SelectedItem); double[] h = FiniteImpulseResponse.ImpulseCharacteristic(signal.Hz, n, threshold, impCharType, windowType); var form = new ShowSpectrumForm(h, " Импульсная характеристика", SpectrumType.NotSet, n); form.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void showPhaseResponseButton_Click(object sender, EventArgs e) { Stopwatch watch = new Stopwatch(); try { var impCharType = (FirFilterType)Enum.Parse(typeof(FirFilterType), (string)impulseCharacteristicTypeComboBox.SelectedItem); int n = (int)impulceCharacteristicNNumericUpDown.Value; double threshold = (double)impulceCharacteristicThresholdNumericUpDown.Value; watch.Start(); double[] h = FiniteImpulseResponse.ImpulseCharacteristic(signal.Hz, n, threshold, impCharType); double[] phaseSpec = FiniteImpulseResponse.PhaseResponse(h, signal.Hz); watch.Stop(); var form = new ShowSpectrumForm(phaseSpec, "ФЧX", SpectrumType.Phase, signal.Hz, watch.ElapsedMilliseconds); form.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void showFrequencyResponseDButton_Click(object sender, EventArgs e) { Stopwatch watch = new Stopwatch(); try { int n = (int)impulceCharacteristicNNumericUpDown.Value; double threshold = (double)impulceCharacteristicThresholdNumericUpDown.Value; var windowType = GetFourierTransformType(); var impCharType = (FirFilterType)Enum.Parse(typeof(FirFilterType), (string)impulseCharacteristicTypeComboBox.SelectedItem); watch.Start(); double[] h = FiniteImpulseResponse.ImpulseCharacteristic(signal.Hz, n, threshold, impCharType, windowType); double[] amplSpec = FiniteImpulseResponse.FrequencyResponse(h, signal.Hz); watch.Stop(); var form = new ShowSpectrumForm(amplSpec, "АЧX", SpectrumType.AmplitudeDecibels, signal.Hz, watch.ElapsedMilliseconds); form.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }