Ejemplo n.º 1
0
        public Result2D GetRealImageData(float startFrequency, float endFrequency)
        {
            //Filter the data with start and end frequency
            Result2D result = new Result2D(DataDomainType.FrequencyDomain, "Frequency", timeDomainSource.ValueLabel + " FFT-Real", timeDomainSource.ValueLabel + " Imag");

            for (int i = 0; i < fftDataLength; i++)
            {
                float freq = i * step;
                if (freq >= startFrequency && freq <= endFrequency)
                {
                    result.Keys.Add(freq);
                    result.Values1.Add(fftOriginResult[i * 2]);
                    result.Values2.Add(fftOriginResult[i * 2 + 1]);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public Result2D GetAmpPhaseData(float startFrequency, float endFrequency)
        {
            //Filter the data with start and end frequency
            Result2D result = new Result2D(DataDomainType.FrequencyDomain, "Frequency", timeDomainSource.ValueLabel + " FFT-Amp", timeDomainSource.ValueLabel + " FFT-Phase");

            for (int i = 0; i < fftDataLength; i++)
            {
                float freq = i * step;
                if (freq >= startFrequency && freq <= endFrequency)
                {
                    result.Keys.Add(freq);

                    float amp = (float)Math.Sqrt(fftOriginResult[i * 2] * fftOriginResult[i * 2] + fftOriginResult[i * 2 + 1] * fftOriginResult[i * 2 + 1]);

                    float phase = (float)(Math.Atan2(fftOriginResult[i * 2 + 1], fftOriginResult[i * 2]) * 180 / Math.PI);

                    result.Values1.Add(amp);
                    result.Values2.Add(phase);
                }
            }

            return(result);
        }