help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with FFT and IFFT


From: Steve C. Thompson
Subject: Re: Problems with FFT and IFFT
Date: Tue, 28 Feb 2006 11:56:25 -0800
User-agent: Mutt/1.5.9i

On 28 Feb 06 14:27PM, John W. Eaton wrote:
> On 28-Feb-2006, Sascha Berkenkamp wrote:
> 
> | Must I set all values smaller than eps to zeros?
> 
> You can do that if you think it is appropriate for your application.

I've had experience with this precision issue too.  Here's an
example:

  A1 = rand (1, 5) + j * rand (1, 5);
  A = [0, A1, conj(fliplr (A1))];
  a = ifft (A);
  isreal (a)

  A1 = rand (1, 50) + j * rand (1, 50);
  A = [0, A1, conj(fliplr (A1))];
  a = ifft (A);
  isreal (a)

The output of the IFFT should be real-valued since the input
vector is complex-conjugate symmetric.  On my system [uname -a:
Linux ... 2.6.12-10-386 ...  i686 GNU/Linux; octave --version:
GNU Octave, version 2.1.71 (i486-pc-linux-gnu)], I get:

  octave:1> A1 = rand (1, 5) + j * rand (1, 5);
  octave:2> A = [0, A1, conj(fliplr (A1))];
  octave:3> a = ifft (A);
  octave:4> isreal (a)
  ans = 1

  octave:5>
  octave:5> A1 = rand (1, 50) + j * rand (1, 50);
  octave:6> A = [0, A1, conj(fliplr (A1))];
  octave:7> a = ifft (A);
  octave:8> isreal (a)
  ans = 0

So for the longer vector, the precision issue creeps in.  In this
particular case, I just follow the IFFT with a `real ()'.

Steve



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]