org.opensourcephysics.analysis
Class FourierAnalysis

java.lang.Object
  extended by org.opensourcephysics.analysis.FourierAnalysis
All Implemented Interfaces:
Data

public class FourierAnalysis
extends java.lang.Object
implements Data

FourierAnalysis adds gutter points to complex-number data before performing a fast Fourier transform. Gutter points increase the number points in order to approximate a nonperiodic function. The FFT output is phase shifted to account for the fact that the FFT basis functions are defined on [0, 2*pi].

Version:
1.0
Author:
W. Christian

Constructor Summary
FourierAnalysis()
           
 
Method Summary
 double[] doAnalysis(double[] x, double[] z, int gutter)
          Fourier analyzes the given complex data z[] after adding gutter points at the start and end of the z[] array.
 java.util.ArrayList getComplexDatasets()
          Gets a complex dataset that contains the result of the last Fourier analysis.
 double[][] getData2D()
          Gets the frequencies, real, and imaginary coefficients.
 double[][][] getData3D()
          3D data is not available.
 java.util.ArrayList getDatasets()
          Gets the complex datasets that contain the result of the last Fourier analysis.
 double[] getNaturalFreq()
          Gets the frequencies of the Fourier spectrum.
 double[] getNaturalOmega()
          Gets the angular frequencies of the Fourier spectrum.
 boolean isRadians()
          Gets the radians flag.
 double[] repeatAnalysis(double[] z)
          Repeats the Fourier analysis of the complex data z[] with the previously set scale and gutter.
 void useRadians(boolean radians)
          Sets the radians flag for the frequency values of datasets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FourierAnalysis

public FourierAnalysis()
Method Detail

doAnalysis

public double[] doAnalysis(double[] x,
                           double[] z,
                           int gutter)
Fourier analyzes the given complex data z[] after adding gutter points at the start and end of the z[] array.

Parameters:
x - double[]
z - double[]
gutter - int
Returns:
double[] the Fourier spectrum

repeatAnalysis

public double[] repeatAnalysis(double[] z)
Repeats the Fourier analysis of the complex data z[] with the previously set scale and gutter.

Parameters:
z - double[]
Returns:
double[] the Fourier spectrum

getNaturalOmega

public double[] getNaturalOmega()
Gets the angular frequencies of the Fourier spectrum.

Returns:
double[]

getNaturalFreq

public double[] getNaturalFreq()
Gets the frequencies of the Fourier spectrum.

Returns:
double[]

useRadians

public void useRadians(boolean radians)
Sets the radians flag for the frequency values of datasets. Dataset x-values are either frequencies (cycles) or angular frequencies (radians) depending on the value of the radians flag.

Parameters:
radians - boolean

isRadians

public boolean isRadians()
Gets the radians flag. Radians is true if the dataset uses angular frequency as the x-coordinate.

Returns:
boolean

getComplexDatasets

public java.util.ArrayList getComplexDatasets()
Gets a complex dataset that contains the result of the last Fourier analysis. Complex dataset x-values are either frequencies (cycles) or angular frequencies (radians) depending on the value of the radians flag.

Specified by:
getComplexDatasets in interface Data
Returns:
list of ComplexDatasets

getDatasets

public java.util.ArrayList getDatasets()
Gets the complex datasets that contain the result of the last Fourier analysis. Real coefficients are contained in the first dataset. Complex coefficients are in the second dataset.

Specified by:
getDatasets in interface Data
Returns:
list of Datasets

getData2D

public double[][] getData2D()
Gets the frequencies, real, and imaginary coefficients.

Specified by:
getData2D in interface Data
Returns:
double[][]

getData3D

public double[][][] getData3D()
3D data is not available.

Specified by:
getData3D in interface Data
Returns:
double[][][]