Frage

The documentation says

public void realForward(double[] a):

Computes 1D forward DFT of real data leaving the result in a . The physical layout of the output data is as follows:

if n is even then

a[2*k] = Re[k], 0<=k<n/2

a[2*k+1] = Im[k], 0<k<n/2

a[1] = Re[n/2]

From this thread: Power Spectral Density from jTransforms DoubleFFT_1D

I figured out the first element is the DC element, and the second one corresponds to the last one. It would be more convenient to discard the first two instead of giving them a special treat. Is it OK to discard the DC element? And the last?

If it is NOT OK, should I compute the Magnitude for the DC Element? And what about the last element that has no corresponding imaginary value?

Like that? magnitude = Math.sqrt(Re[n/2]*Re[n/2]);

War es hilfreich?

Lösung

The DC (0 Hz) and Nyquist (Fs / 2) components are purely real, which is why you can fit both of them into the same space as a complex value, so no need to calculate a magnitude for these. Nyquist you can definitely ignore - it's not needed for most practical applications. The DC component you can probably ignore, but it depends on what you are trying to do in your particular application.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top