Package org.opensourcephysics.analysis
Class FourierAnalysis
java.lang.Object
org.opensourcephysics.analysis.FourierAnalysis
- All Implemented Interfaces:
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
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.String[]
The column names to be used in the data display tooldouble[][]
Gets the frequencies, real, and imaginary coefficients.double[][][]
3D data is not available.Gets a list that contains the complex dataset of the last Fourier analysis.Gets the complex datasets that contain the result of the last Fourier analysis.Color[]
Fill colors for Data interface.int
getID()
Returns a unique identifier for this Data.Color[]
Line colors for Data interface.getName()
Gets the dataset name.double[]
Gets the frequencies of the Fourier spectrum.double[]
Gets the angular frequencies of the Fourier spectrum.boolean
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
setID
(int id) Sets the ID number of this Data.void
Sets a name that can be used to identify the dataset.void
useRadians
(boolean radians) Sets the radians flag for the frequency values of datasets.
-
Field Details
-
datasetID
protected int datasetID
-
-
Constructor Details
-
FourierAnalysis
public FourierAnalysis()
-
-
Method Details
-
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
-
getDataList
Gets a list that contains the complex dataset 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:
getDataList
in interfaceData
- Returns:
- list of ComplexDatasets
-
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 interfaceData
- Returns:
- list of Datasets
-
getData2D
public double[][] getData2D()Gets the frequencies, real, and imaginary coefficients. -
getData3D
public double[][][] getData3D()3D data is not available. -
setName
Sets a name that can be used to identify the dataset.- Parameters:
name
- String
-
getName
Gets the dataset name. -
getColumnNames
The column names to be used in the data display tool- Specified by:
getColumnNames
in interfaceData
- Returns:
-
getLineColors
Line colors for Data interface.- Specified by:
getLineColors
in interfaceData
- Returns:
-
getFillColors
Fill colors for Data interface.- Specified by:
getFillColors
in interfaceData
- Returns:
-
setID
public void setID(int id) Sets the ID number of this Data. -
getID
public int getID()Returns a unique identifier for this Data.
-