org.opensourcephysics.numerics
Class FFTReal

java.lang.Object
  extended by org.opensourcephysics.numerics.FFTReal

public class FFTReal
extends java.lang.Object

FFTReal computes the discrete Fourier coefficients a[0], ...., a[N/2] and b[1], ...., b[N/2 - 1] of the discrete partial Fourier sum a[0] + a[1]*cos(N/2*omega*x) + Sum (k=1,2,...,N/2-1) (a[2*k] * cos(k * omega * x) + a[2*k+1] * sin(k * omega * x)) given real functional values y[0], ...., y[N-1]. Adapted by W. Christian for use in the OSP project.

Version:
1.0
Author:
Bruce R. Miller bruce.miller@nist.gov, Contribution of the National Institute of Standards and Technology,, Derived from GSL (Gnu Scientific Library), GSL's FFT Code by Brian Gough bjg@vvv.lanl.gov, Since GSL is released under, GPL,, this class must also be.

Constructor Summary
FFTReal()
          Constructs a real FFT transformation for n data points.
FFTReal(int n)
          Constructs a real FFT transformation for n data points.
 
Method Summary
 double[] backtransform(double[] data)
          Computes the (unnomalized) inverse FFT of data, leaving it in place.
 int getN()
          Gets the number of data points.
 double[] getNaturalFreq(double delta)
          Gets an array containing the frequencies in natural order.
 double[] getNaturalFreq(double xmin, double xmax)
          Gets an array containing the frequencies in natural order.
 double[] getNaturalOmega(double delta)
          Gets an array containing the frequencies in natural order.
 double[] getNaturalOmega(double xmin, double xmax)
          Gets an array containing the frequencies in natural order.
 double[] inverse(double[] data)
          Computes the (nomalized) inverse FFT of data, leaving it in place.
 void setN(int n)
          Sets the number of data points.
 double[] transform(double[] data)
          Computes the Fast Fourier Transform of the data leaving the result in data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FFTReal

public FFTReal()
Constructs a real FFT transformation for n data points.


FFTReal

public FFTReal(int n)
Constructs a real FFT transformation for n data points.

Parameters:
n - the number of data points
Method Detail

setN

public void setN(int n)
Sets the number of data points.

Parameters:
n - int

getN

public int getN()
Gets the number of data points.

Returns:
int

transform

public double[] transform(double[] data)
Computes the Fast Fourier Transform of the data leaving the result in data. The given array is returned after it has been transformed.

Parameters:
data - double[] the data to be transformed
Returns:
double[] the data after the FFT

backtransform

public double[] backtransform(double[] data)
Computes the (unnomalized) inverse FFT of data, leaving it in place. The given array is returned after it has been transformed.

Parameters:
data - double[] the data to be transformed
Returns:
double[] the data after the FFT

inverse

public double[] inverse(double[] data)
Computes the (nomalized) inverse FFT of data, leaving it in place. The given array is returned after it has been transformed.

Parameters:
data - double[] the data to be transformed
Returns:
double[] the data after the FFT

getNaturalFreq

public double[] getNaturalFreq(double delta)
Gets an array containing the frequencies in natural order. Data are separated by delta.

Parameters:
delta -
Returns:
the array of frequencies

getNaturalFreq

public double[] getNaturalFreq(double xmin,
                               double xmax)
Gets an array containing the frequencies in natural order. The first data point is at xmin (tmin) and the last data point is at xmax (tmax).

Parameters:
xmin -
xmax -
Returns:
the array of frequencies

getNaturalOmega

public double[] getNaturalOmega(double delta)
Gets an array containing the frequencies in natural order. Data are separated by delta.

Parameters:
delta -
Returns:
the array of frequencies

getNaturalOmega

public double[] getNaturalOmega(double xmin,
                                double xmax)
Gets an array containing the frequencies in natural order. The first data point is at xmin (tmin) and the last data point is at xmax (tmax).

Parameters:
xmin -
xmax -
Returns:
the array of frequencies