Package xal.tools.math
Class DiscreteFourierTransform
java.lang.Object
xal.tools.math.DiscreteFourierTransform
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
getFrequency
(int index) get the frequency associated with the frequency indexComplex[]
get the transform at the specified frequency indexint
get the count of the elements in the transformdouble
getTime
(int index) get the time for the specified time indexdouble[]
get the time based array of values
-
Constructor Details
-
DiscreteFourierTransform
public DiscreteFourierTransform(double[] values, double period) Constructor- Parameters:
values
- is an even number of values evenly spaced over timeperiod
- 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
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
-