/// <summary> /// 获取测试波形各阶的相位谱 /// </summary> /// <returns></returns> public ArrayPair <double, double>[] GetPhaseSpectrum() { ArrayPair <double, double>[] spectrums = new ArrayPair <double, double> [refWaveform.Steps]; for (ushort i = 0; i < spectrums.Length; i++) { double[] xData = new double[analyzer.GetSpectrumLength((ushort)(i + 1))]; double[] yData = new double[analyzer.GetSpectrumLength((ushort)(i + 1))]; spectrums[i] = new ArrayPair <double, double>(xData, yData); } double maxFrequency = refWaveform.GetSampleRate() / 2; for (ushort stepIndex = 1; stepIndex < refWaveform.Steps; stepIndex++) { uint spectrumLength = analyzer.GetSpectrumLength(stepIndex); double frequencyStep = maxFrequency / spectrumLength; for (int j = 0; j < spectrumLength; j++) { spectrums[stepIndex].XData[j] = (j + 1) * frequencyStep; } analyzer.GetPhaseSpectrum(spectrums[stepIndex].YData, stepIndex); } return(spectrums); }
public void ShowResult() { ArrayPair <double, double> responses = _analyzer.GetResponse(); easyChart_response.Plot(responses.XData, responses.YData); ArrayPair <double, double> thds = _analyzer.GetTHD(); easyChart_thd.Plot(thds.XData, thds.YData); }
public void ShowResult() { StringBuilder dispResult = new StringBuilder(); string newLine = Environment.NewLine; const string delim = ","; dispResult.Append("PeakToPeak(V):").Append(newLine).Append(_analyzer.GetPeakToPeak()).Append(newLine); dispResult.Append("THD(db):").Append(newLine).Append(_analyzer.GetTHDInDb()).Append(newLine); dispResult.Append("Noise Ratio(db):").Append(newLine).Append(_analyzer.GetNoiseRatioInDb()).Append(newLine); dispResult.Append("Thd Plus Noise Ratio(dB):") .Append(newLine) .Append(_analyzer.GetNoiseRatioInDb()) .Append(newLine); ArrayPair <double, double> harmonicPower = _analyzer.GetHarmonicPower(); dispResult.Append("Harmoic Power:").Append(newLine).Append(harmonicPower.YData[0]).Append(delim) .Append(harmonicPower.YData[1]).Append(delim).Append(harmonicPower.YData[2]).Append(delim). Append(harmonicPower.YData[3]).Append(delim).Append(harmonicPower.YData[4]).Append(delim). Append(harmonicPower.YData[5]); textBox_result.Text = dispResult.ToString(); }
public void ShowResult() { // easyChart_power.Plot(frequency, powerSpectrum); ArrayPair <double, double> powerSpectrum = _analyzer.GetPowerSpectrum(); easyChart_power.Plot(powerSpectrum.XData, powerSpectrum.YData); // easyChart_phase.Plot(frequency, phaseSpectrum); ArrayPair <double, double> phaseSpectrum = _analyzer.GetPhaseSpectrum(); easyChart_phase.Plot(phaseSpectrum.XData, phaseSpectrum.YData); StringBuilder dispResult = new StringBuilder(); string newLine = System.Environment.NewLine; dispResult.Append("Amplitude(V):").Append(newLine).Append(_analyzer.GetPeakToPeak()).Append(newLine); dispResult.Append("AC RMS(V):").Append(newLine).Append(_analyzer.GetACRms()).Append(newLine); dispResult.Append("DC RMS(V):").Append(newLine).Append(_analyzer.GetDCRms()).Append(newLine); dispResult.Append("Max(V):").Append(newLine).Append(_analyzer.GetMax()).Append(newLine); dispResult.Append("Min(V):").Append(newLine).Append(_analyzer.GetMin()).Append(newLine); dispResult.Append("TD+N(dB):").Append(newLine).Append(_analyzer.GetTDPlusN()).Append(newLine); textBox_result.Text = dispResult.ToString(); }
public void ShowResult() { ArrayPair <double, double> crossTalk = _analyzer.GetCrossTalk(); easyChart_corssTalk.Plot(crossTalk.XData, crossTalk.YData); }
public static void Main(string[] args) { /* Problem 01 = Bubble Sort */ System.Console.WriteLine("Problem 01 = Bubble Sort"); var bubbleSort = BubbleSort.Of(); bubbleSort.Execute(); bubbleSort.Show(); /* * Console * Array initial => [2] [1] [20] [5] [9] [10] [7] [8] [6] [0] [11] * Sorted array => [0] [1] [2] [5] [6] [7] [8] [9] [10] [11] [20] */ /* Problem 02 = Array pair */ System.Console.WriteLine("\nProblem 02 = Array pair"); var arrayPair = ArrayPair.Of(); arrayPair.Execute(); arrayPair.Show(); /* * Console * Result => [7] */ /* Problem 03 = Matrix Parallel */ System.Console.WriteLine("\nProblem 03 = Matrix Parallel"); /* Matrix settings */ var matrix = Matrix.Of( lineA: 2, columnA: 2, lineB: 2, columnB: 2 ); var matrixParallel = MatrixParallel.Of(matrix); /* Factor (Optional) */ matrixParallel.FactorA = 10; matrixParallel.FactorB = 20; matrixParallel.Execute(); matrixParallel.Show(); /* * Console: Example A(2x2), B(2x2) * Parallel - Elements of Matrix A * [0, 0] = 9 * [0, 1] = 2 * [1, 0] = 7 * [1, 1] = 4 * Parallel - Elements of Matrix B * [0, 0] = 18 * [0, 1] = 16 * [1, 0] = 18 * [1, 1] = 3 * Parallel - Elements of Matrix Resulting (A X B) * [0, 0] = 198 * [0, 1] = 150 * [1, 0] = 198 * [1, 1] = 124 */ }