Class DiscreteFourierTransform

java.lang.Object
xal.tools.math.DiscreteFourierTransform

public class DiscreteFourierTransform extends Object
Calculates the discrete Fourier transform. While not as efficient as a fast Fourier transform, it offers more flexibility. transform(f) = 1/2N * sum( f(t) e^(i pi p k / N) ), k = 0...2N-1, t = kT/2N, freq = 2 pi p / T, p = 0...2N-1
  • Constructor Details

    • DiscreteFourierTransform

      public DiscreteFourierTransform(double[] values, double period)
      Constructor
      Parameters:
      values - is an even number of values evenly spaced over time
      period - is the time period
      Throws:
      RuntimeException - if the number of time based elements is not even
  • Method Details

    • getValues

      public double[] getValues()
      get the time based array of values
    • getTime

      public double getTime(int index)
      get the time for the specified time index
    • getSpectrum

      public Complex[] getSpectrum()
      get the transform at the specified frequency index
    • getSpectrumCount

      public int getSpectrumCount()
      get the count of the elements in the transform
    • getFrequency

      public double getFrequency(int index)
      get the frequency associated with the frequency index