# FFT / IFFT

Started by January 1, 2006
```Hello everybody,

I'm a DSP newbie and have some basic questions.

I want to process a signal with a FFT, a filter and then with an IFFT back
in a time-domain signal

The test system has the following setup.
1.) FFT of the time-domain signal
2.) IFFT of the freq-domain signal
Both transformation are with complex values. The ifft is implemented as
fft with confugated input values.

As test signal I just use a sinus wave (real values only).
The output of the fft looks ok. But the back transformed signal does not
look like a sinus-wave. You can guess that it should look like a
sinus-wave,but there are big steps and jumps in it.

The questions:
1.) Is the basic way correct, that a signal with FFT and IFFT must give
the same original signal back?

Peter

```
```"pm998" <Peter.Meier998@gmx.de> writes:

> Hello everybody,
>
> I'm a DSP newbie and have some basic questions.
>
> I want to process a signal with a FFT, a filter and then with an IFFT back
> in a time-domain signal
>
> The test system has the following setup.
> 1.) FFT of the time-domain signal
> 2.) IFFT of the freq-domain signal
> Both transformation are with complex values. The ifft is implemented as
> fft with confugated input values.
>
> As test signal I just use a sinus wave (real values only).
> The output of the fft looks ok. But the back transformed signal does not
> look like a sinus-wave. You can guess that it should look like a
> sinus-wave,but there are big steps and jumps in it.
>
> The questions:
> 1.) Is the basic way correct, that a signal with FFT and IFFT must give
> the same original signal back?

Yes, except that sometimes the origin (t=0) shifts.

Make sure you're sending the IFFT both real and imaginaray outputs from the FFT.

Check that your IFFT and FFT algorithms are giving the correct output
(take the FFT of a sinusoid and see what it gives; take the IFFT of a
sinusoid and see what it gives; the two should be similar up to a
phase difference).

Try it with short signals (e.g. 4 points) first, so you know what is
supposed to be happening and can calculate it by hand.

Ciao,

Peter K.

--
"And he sees the vision splendid
of the sunlit plains extended
And at night the wondrous glory of the everlasting stars."

```
```I'm not sure exactly what you're asking, but I think I know the answer.
As long as you don't do anything to the signal, then ifft(fft(x))==x.

There are some tricks for getting the ifft witht the fft.  When you
take the fft from the time domain, you get the signal in the frequency
domain.  If you take the fft of that, you'll end up in the time domain
but with with axis reversed. Like you said, you can take the conjugate
before taking the fft.  Because of conjugate symmetry, this will put
you in the frequency domain, but axis reversed.  Then taking the fft
will put you back in the time domain.

Knowing this, you should be able to carefully verify each step of the
process.  (For testing, use matlab if you have it, octave if you
don't.)  After taking the conjugate, the axis should be reversed.  Pay
careful attention to whether you have an even or odd number of samples
and where the negative bins  are (before or after the positve ones in
the array) and where negative and positve bins start and stop.  If the
fft was correct, and the axis is reversed, you'll get back what you
originally put in when you use the fft again.

Oh and one more thing.  There is a scaling factor in there.  You need
to divide by the number of samples.  The ifft does this (to make the
transform matrix unitary so it's exactly an inverse of the fft
transform I think).

--
Todd
http://www.signalsguru.net

```
```pm998 wrote:
> Hello everybody,
>
> I'm a DSP newbie and have some basic questions.
>
> I want to process a signal with a FFT, a filter and then with an IFFT back
> in a time-domain signal
>
> The test system has the following setup.
> 1.) FFT of the time-domain signal
> 2.) IFFT of the freq-domain signal
> Both transformation are with complex values. The ifft is implemented as
> fft with confugated input values.
>
> As test signal I just use a sinus wave (real values only).
> The output of the fft looks ok. But the back transformed signal does not
> look like a sinus-wave. You can guess that it should look like a
> sinus-wave,but there are big steps and jumps in it.
>
> The questions:
> 1.) Is the basic way correct, that a signal with FFT and IFFT must give
> the same original signal back?

Other than rounding/accuracy problems, yes  (that is, you will
*always* have rounding/accuracy problems -- if you work with
floating-point or double, then you should get something really
really really close to the original signal).

Try first with everything in double-precision floating-point
to make sure that it's not rounding problems.

Plot the magnitude of the FFT for the sinusoid.  It should
have two prominent peaks at the appropriate angular frequencies
(remember that the FFT results in a "duplicated" mirror-like
symmetric function).  You could try a sinusoid at exactly 1/4
of the sampling frequency (samples 0 +v, 0, -v, 0, +v, ... ),
and verify that you have two peaks at 1/4 and 3/4 of the range.

HTH,

Carlos
--
```
```Thanks a lot for your advice.
I'll try it out.

There is one other point coming in my mind:

I know the effects of the windowing in a fft.
But what is the effect in an ifft?
Could the windows be the reason for the steps?
Who to correct the influence in the output signal?

Thanks a lot
Peter

>Hello everybody,
>
>I'm a DSP newbie and have some basic questions.
>
>I want to process a signal with a FFT, a filter and then with an IFFT
back
>in a time-domain signal
>
>The test system has the following setup.
>1.) FFT of the time-domain signal
>2.) IFFT of the freq-domain signal
>Both transformation are with complex values. The ifft is implemented as
>fft with confugated input values.
>
>As test signal I just use a sinus wave (real values only).
>The output of the fft looks ok. But the back transformed signal does not
>look like a sinus-wave. You can guess that it should look like a
>sinus-wave,but there are big steps and jumps in it.
>
>The questions:
>1.) Is the basic way correct, that a signal with FFT and IFFT must give
>the same original signal back?
>
>
>    Peter
>
>
>

```
```For some window functions, overlap is used to correct the output of the IFFT
for a window applied to the timeseries data put into the FFT.  For example, a
50% overlap will compensate for Hanning windowing.  I was told once, long ago,
that a 75% overlap can be used to compensate for a Kaiser window.

In article <h_Cdndv_vMyfDCTeRVn-tA@giganews.com>, "pm998"
<Peter.Meier998@gmx.de> wrote: