# Imaginary values non-null in FFTW Java wrapper real transform

Started by May 16, 2006
```Hi all,

I was hoping someone could shed some light on this problem Im having. Ill
be as clear as possible.

Im using the Java JNI wrapper for FFTW. The problem I am having is
regarding the imaginary components being returned from a real to complex
tranform.

As I understand it, the format of the array returned by the FFTW real to
complex transform is (for an even N length signal);

[dc][r1][r2][r3][r4][ny][i4][i3][i2][i1]

where
dc = direct component
ny = nyquist
and
(rx, ix) are the various imaginary numbers

If I input a pure cosine wave of fHz, I would assume that all the [ix]
elements of the array would be zero or close enough. However I'm getting
some non-trivial values in the imaginary parts of the array.

I'm at a total loss as to why this is. Are any of my assumptions incorrect
or has anyone had similar experiences?

Sean
```
```SeanOg wrote:

> Hi all,
>
> I was hoping someone could shed some light on this problem Im having. Ill
> be as clear as possible.
>
> Im using the Java JNI wrapper for FFTW. The problem I am having is
> regarding the imaginary components being returned from a real to complex
> tranform.
>
> As I understand it, the format of the array returned by the FFTW real to
> complex transform is (for an even N length signal);
>
> [dc][r1][r2][r3][r4][ny][i4][i3][i2][i1]
>
> where
> dc = direct component
> ny = nyquist
> and
> (rx, ix) are the various imaginary numbers
>
> If I input a pure cosine wave of fHz, I would assume that all the [ix]
> elements of the array would be zero or close enough. However I'm getting
> some non-trivial values in the imaginary parts of the array.
>
> I'm at a total loss as to why this is. Are any of my assumptions incorrect
> or has anyone had similar experiences?
>
>
> Sean

An FFT of a totally real input signal will, in general, return results
with nonzero real and imaginary parts.  If the input signal has even
symmetry around 0 then the FFT should be all real, if it has odd
symmetry around 0 then the FFT should be all imaginary.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com