Thread Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

From: dru22@mindspring.com (dru shockley)

Date: 31 Dec, 1997 19:05:01

Message: 1 of 9

I am trying to retrieve the signal back from an fft. According to the
help files, ifft(fft(S)) should yield the signal S, with some rounding
error. I have tried this numerous times, and get back a time series
not even remotely resembling the original time series. The ifft is
also yielding complex numbers as part of the time series, which were
never part of the original signal. I have tried using the ifft only
on the first have of the mirror fft spectrum, but this didn't correct
the problem. Am I missing a step, or is this a bug in the ifft
routine? Please help.

Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

From: Andy Bartlett

Date: 31 Dec, 1997 15:06:19

Message: 2 of 9

Hi Dru

    The IFFT and FFT should work fine at restoring the SAMPLED signal.

 » y=rand(2^8,1);
» yy=ifft(fft(y));
» max_real_err = max(abs(real(y-yy)))

max_real_err =

  7.4420e-016

» max_imag_err = max(abs(imag(y-yy)))

max_imag_err =

  1.9255e-016

» mean(y)

ans =

    0.4913


Compared to the average value around 0.5 the error above is only a couple
of bits out of the 53 mantissa bits that an IEEE double gives.

To kill the small imaginary part, just do

yy=real(ifft(fft(y)));


I don't know why your restored signal doesn't look like your original
SAMPLED signal. If you are comparing, an UN-sampled version of your
original signal with the restored version, then you may be seeing apparent
differences due to aliasing. However, the restored signal should still
agree with the SAMPLED signal even if aliasing occured.

Andy Bartlett

Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

From: jsuccari@mathworks.com (Jad Succari)

Date: 31 Dec, 1997 20:53:04

Message: 3 of 9

The trick is to plot the real part:

N = 200; %Number of samples
fs = 10; %Sampling rate
a = [1 .25]; %Amplitudes
f = [.05 ; 5]; %Frequencies
t = (0:N-1)/fs; %Time base
x = a*cos(2*pi*f*t); %Signal without noise
subplot(211);
plot(t,x);
subplot(212)
X = real(ifft(fft(x)));
plot(t,X)

Happy New Year!

--Jad

dru shockley (dru22@mindspring.com) wrote:
: I am trying to retrieve the signal back from an fft. According to the
: help files, ifft(fft(S)) should yield the signal S, with some rounding
: error. I have tried this numerous times, and get back a time series
: not even remotely resembling the original time series. The ifft is
: also yielding complex numbers as part of the time series, which were
: never part of the original signal. I have tried using the ifft only
: on the first have of the mirror fft spectrum, but this didn't correct
: the problem. Am I missing a step, or is this a bug in the ifft
: routine? Please help.

Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

From: Dipasree Som

Date: 1 Aug, 2010 14:47:08

Message: 4 of 9

dru22@mindspring.com (dru shockley) wrote in message <34aa967c.7313103@news.mindspring.com>...
> I am trying to retrieve the signal back from an fft. According to the
> help files, ifft(fft(S)) should yield the signal S, with some rounding
> error. I have tried this numerous times, and get back a time series
> not even remotely resembling the original time series. The ifft is
> also yielding complex numbers as part of the time series, which were
> never part of the original signal. I have tried using the ifft only
> on the first have of the mirror fft spectrum, but this didn't correct
> the problem. Am I missing a step, or is this a bug in the ifft
> routine? Please help.

Subject: ifft from fft (Retrieving signal from a fourier transform using ifft)

From: Dipasree Som

Date: 1 Aug, 2010 14:53:05

Message: 5 of 9

hi...
I am using matlab for first time. I want to retrieve back my original time domain signal using ifft and then plot it. Plotting is neglecting the small imaginary part, how can I avoid this and plot this imaginary part together?

Subject: ifft from fft (Retrieving signal from a fourier transform using

From: Walter Roberson

Date: 1 Aug, 2010 17:10:26

Message: 6 of 9

Dipasree Som wrote:

> I am using matlab for first time. I want to retrieve back my original
> time domain signal using ifft and then plot it. Plotting is neglecting
> the small imaginary part, how can I avoid this and plot this imaginary
> part together?

plot(x,real(y),'r',x,imag(y),'g')

Subject: fft and ifft

From: Senthil

Date: 1 Aug, 2010 17:34:05

Message: 7 of 9

timesignal = sin(1:100);
freqsignal = fft(timesignal);
rectimesignal = real(ifft(freqsignal));
here time signal and rectimesignal are same.....

Subject: ifft from fft (Retrieving signal from a fourier transform using

From: Greg Heath

Date: 1 Aug, 2010 17:43:01

Message: 8 of 9

On Aug 1, 10:53 am, "Dipasree Som" <somdip...@gmail.com> wrote:
> hi...
> I am using matlab for first time. I want to retrieve back my original time domain signal using ifft and then plot it. Plotting is neglecting the small imaginary part, how can I avoid this and plot this imaginary part together?

In general, you could use a polar plot

figure
plot(x,'o')
xlabel('Real Part')
ylabel('Imaginary Part')

However, in this case you need different scales

figure
subplot(211)
plot(real(x))
subplot(212)
plot(imag(x))

I'll let you provide the details

Hope this helps.

Greg

Subject: fft and ifft

From: Greg Heath

Date: 1 Aug, 2010 17:54:16

Message: 9 of 9

On Aug 1, 1:34 pm, "Senthil " <senthilponku...@yahoo.co.in> wrote:
> timesignal  = sin(1:100);
> freqsignal = fft(timesignal);
> rectimesignal = real(ifft(freqsignal));
> here time signal and rectimesignal are same.....

No they aren't:

x = sin(1:100);
X = fft(x);
recx = real(ifft(X));

% In the context of this thread, recx and x
% are NOT the same.....

err = recx-x;
minmaxerr = minmax(err)

>>
minmaxerr =

 -5.8287e-016 5.5511e-016

Hope this helps.

Greg

Tags for this Thread

Everyone's Tags:

fft

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fft Senthil Ponkumar 1 Aug, 2010 13:39:05
rssFeed for this Thread

Contact us at files@mathworks.com