Android Programming Press on the image to return to the main documentation page.

FFT

This library contains an FFT object for performing Fast Fourier Transforms.
This is a port of the FFT from the SciMark2a Java Benchmark to C# by
Chris Re ([email protected]) and Werner Vogels ([email protected]).
For details on the original authors see http://math.nist.gov/scimark2.
Further modified by Andrew Graham to support separate Real and Imaginary arrays

List of types:

FFT

FFT

This is the FFT object for performing Fast Fourier Transforms.
The FFT object in this library requires that the length of the real and imaginary data
arrays are some power of 2 and are of the same size as each other. The most common use
for an FFT is to analyse a sampled data series in terms of the frequencies it contains.
In the real world each sample consists only of a real amplitude value. To transform this
time sampled series into a frequency series the amplitude values are placed in time sequence
into the real array and all the values in the corresponding imaginary array are set to zero.

Once the FFT.Transform method has been called the real array will contain the amplitude values
of the Cosine elements of the waveform and the imaginary array will contain the amplitudes of
the Sine elements. Usually only the first half of each array is relevant as the last half of the
array contains the same information as the first half but expressed as its' complex conjugate.
Because of this Transform2 is provided that takes only a real time series and returns the relevant
halves of the real and imaginary results leaving the original data series intact.

Often the vector amplitude, and possibly the relative phase, of the frequency components is
required. The FFT.ToAmplitude and FFT.ToPhase can transform the Cosine and Sine result from the
transform to this format. The corresponding methods to transform amplitude and phase data back to
real and imaginary data are provided and also the inverse FFT to transform real and imaginary
frequency data back to time domain data.

Events:

None

Members:


  CopyArray (array() As Double) As Double()

  CopyData (srcarray() As Double, destarray() As Double, length As Int)

  Inverse (real() As Double, imag() As Double)

  Inverse2 (halfreal() As Double, halfimag() As Double, data() As Double)

  ToAmplitude (real() As Double, imag() As Double) As Double()

  ToImaginaryl (amplitude() As Double, phase() As Double) As Double()

  ToPhase (real() As Double, imag() As Double) As Double()

  ToReal (amplitude() As Double, phase() As Double) As Double()

  Transform (real() As Double, imag() As Double)

  Transform2 (data() As Double, halfreal() As Double, halfimag() As Double)

  Version As Double [read only]

Members description:

CopyArray (array() As Double) As Double()
Returns a new Double array that is a copy of the specified one dimensional Double array.
CopyData (srcarray() As Double, destarray() As Double, length As Int)
Copies the length number of elements from the one dimensional Double srcarray starting at the first element to one
dimensional Double destarray starting at the first element.
Inverse (real() As Double, imag() As Double)
Performs an inverse FFT on the frequency domain cosine and sine data in the real and
imaginary arrays and replaces the frequency domain data with the the real and imaginary
time domain data. The transform is made in place and the contents of the specified arrays
are altered to contain the result The length of the arrays must be the same and be a power of 2.
Inverse2 (halfreal() As Double, halfimag() As Double, data() As Double)
Performs an inverse FFT on the frequency domain cosine and sine data in the real and
imaginary arrays and places the real part of the resulting time domain data in data.
The halfreal and halfimag arrays are assumed to contain the first half of the frequency
domain data and remain unchanged when the method returns. The necessary complex conjugates
of each are calculated internally in the method and used in the inverse transform.
The length of the data array must be a power of 2 and the length of the halfreal and halfimag
arrays must be half that of the data array.
ToAmplitude (real() As Double, imag() As Double) As Double()
Returns a new array of Doubles containing the vector amplitude values calculated from
the cosine and sine data in the real and imaginary arrays provided. The length of the
arrays must be the same.
ToImaginaryl (amplitude() As Double, phase() As Double) As Double()
Returns a new array of Doubles containing the imaginary (Sine) values calculated from
the amplitude and phase data in the amplitude and phase arrays provided. The length
of the input arrays must be the same.
ToPhase (real() As Double, imag() As Double) As Double()
Returns a new array of Doubles containing the vector phase values, in degrees, calculated
from the cosine and sine data in the real and imaginary arrays provided. The length of the
input arrays must be the same.
ToReal (amplitude() As Double, phase() As Double) As Double()
Returns a new array of Doubles containing the real (Cosine) values calculated from
the amplitude and phase data in the amplitude and phase arrays provided. The length
of the input arrays must be the same.
Transform (real() As Double, imag() As Double)
Performs a forward FFT on the time domain data in the real and imaginary arrays and
replaces the time domain data with the real and imaginary cosine and sine frequency
domain data. The transform is made in place and the contents of the specified arrays
are altered to contain the result. The length of the arrays must be the same and be a
power of 2.
Transform2 (data() As Double, halfreal() As Double, halfimag() As Double)
Performs a forward FFT on the time domain data in the data array and places the first
half of the real and imaginary cosine and sine frequency domain data in the halfreal and
halfimag arrays discarding the complex conjugate parts. The imaginary components of the
time domain data for the transform are set to zero within the method and the data array
is unchanged when the method returns. The length of the data array must be a power of 2
and the length of the halfreal and halfimag arrays must be half that of the data array.
Version As Double [read only]
Returns the version number of the library.
Top