Esempio n. 1
0
 /// <summary>
 /// Calculates N-point frequency domain transform (Fast-Fourier Transform) of the given signal
 /// </summary>
 /// <param name="s">signal object</param>
 /// <param name="N">value of N for N-point FFT</param>
 /// <returns>Array of Complex[Re,Im] values</returns>
 public static Complex[] FFT(this OpenSignalLib.Sources.Signal s, int N = 1024)
 {
     float[] sig = new float[s.Samples.Length];
     for (int i = 0; i < s.Length; i++)
     {
         sig[i] = (float)s.Samples[i];
     }
     Complex[] fft = LiquidFFT.fft(sig, N);
     return(fft);
 }
Esempio n. 2
0
 /// <summary>
 /// Calculates N-point frequency domain transform (Fast-Fourier Transform) of the given signal
 /// </summary>
 /// <param name="sig">Samples of the signal</param>
 /// <param name="N">value of N for N-point FFT</param>
 /// <returns>Array of Complex[Re,Im] values</returns>
 public static Complex[] FFT(double[] sig, int N = 1024)
 {
     Complex[] retval         = new Complex[sig.Length];
     float[]   signal_samples = new float[sig.Length];
     for (int i = 0; i < sig.Length; i++)
     {
         signal_samples[i] = (float)sig[i];
     }
     retval = LiquidFFT.fft(signal_samples, N);
     return(retval);
 }