예제 #1
0
        public void PlotSignals()
        {
            Signal workbookSourceSignal = workBookManager.ActiveWorkBook().SumOfSources();

            SignalWaveFile     = null;
            PlotPoints         = new List <DataPoint>(512);
            FrequencyViewModel = null;

            // Return empty set, this clears the display when all signals are off
            if (workbookSourceSignal == null)
            {
                NotifyPropertyChanged(nameof(PlotPoints));
                NotifyPropertyChanged(nameof(FrequencyViewModel));
                return;
            }

            CreateWavFile(workbookSourceSignal);

            for (int idx = 0; idx < workbookSourceSignal.Samples.Count; idx++)
            {
                PlotPoints.Add(new DataPoint(idx, workbookSourceSignal.Samples[idx]));
            }

            //IDFT cmplxFFT = new ComplexFastFourierTransform();
            IDFT cmplxFFT = new DSPGuideComplexDiscreteFourierTransform();

            FrequencyDomain frequencyDomain = cmplxFFT.Transform(workbookSourceSignal.Samples, workbookSourceSignal.SamplingHZ);


            FrequencyViewModel = new FrequencyHistogramViewModel(frequencyDomain);

            NotifyPropertyChanged(nameof(PlotPoints));
            NotifyPropertyChanged(nameof(FrequencyViewModel));
        }
예제 #2
0
        public void PlotData()
        {
            List <double> summedFilterData = manager.ActiveWorkBook().CombinedFilterImpulseResponse();

            if (null == summedFilterData)
            {
                return;
            }

            Signal workbookSourceSignal = manager.ActiveWorkBook().SumOfSources();

            if (workbookSourceSignal == null)
            {
                return;
            }

            SignalPlotPoints = new List <DataPoint>(workbookSourceSignal.Samples.Count);

            for (int idx = 0; idx < workbookSourceSignal.Samples.Count; idx++)
            {
                SignalPlotPoints.Add(new DataPoint(idx, workbookSourceSignal.Samples[idx]));
            }

            ConvolutionPlotPoints = new List <DataPoint>(summedFilterData.Count);

            for (int idx = 0; idx < summedFilterData.Count; idx++)
            {
                ConvolutionPlotPoints.Add(new DataPoint(idx, summedFilterData[idx]));
            }

            List <double> convolutionResult = convolver.Convolve(summedFilterData, workbookSourceSignal.Samples, ConvolutionType.INPUTSIDE);

            ResultPlotPoints = new List <DataPoint>(convolutionResult.Count);
            for (int idx = 0; idx < convolutionResult.Count; idx++)
            {
                ResultPlotPoints.Add(new DataPoint(idx, convolutionResult[idx]));
            }

            //IDFT cmplxFFT = new ComplexFastFourierTransform();
            IDFT cmplxFFT = new DSPGuideComplexDiscreteFourierTransform();

            FrequencyDomain frequencyDomain = cmplxFFT.Transform(convolutionResult, workbookSourceSignal.SamplingHZ);

            ResultFrequencyHistogram = new FrequencyHistogramViewModel(frequencyDomain);

            NotifyPropertyChanged(nameof(SignalPlotPoints));
            NotifyPropertyChanged(nameof(ConvolutionPlotPoints));
            NotifyPropertyChanged(nameof(ResultPlotPoints));
            NotifyPropertyChanged(nameof(ResultFrequencyHistogram));
        }