# [R] fft help

Rolf Turner rolf at math.unb.ca
Tue Mar 11 14:53:06 CET 2003

```Kenneth Cabrera wrote:

> I want to know if there is an easy way to obtain a Fourier Transform
> form a vector or an array (just like fft does),  but with a more
> density base.  I mean, if I have a vector of 512 of length, I want
> the Fourier Transform to be 1024, or 2048, etc, in length (de u
> domain). Or should I modify the fft C code to do that?

There is rarely if ever any point in calculating the discrete Fourier
transform at any more than n Frequencies (where n is the length of
the signal), because the transform at the n frequencies encodes
***all*** of the information in the original signal.

I.e. if you know the DFT at the Fourier frequencies omega_j, j = 0,
..., n-1 (omega_j = 2*pi*j/n, in radians per unit time) then you can
recover the original signal exactly from these values (via the
inverse DFT).

If you ***INSIST*** on calculating the DFT at a finer grid and want
to do this via the FFT, it is simple:  Just pad your signal with 0s.
E.g. if your signal has length 512 and you pad with 512 0s you will
get the DFT at Fourier frequencies with denominator 1024.

Do not kid yourself that you have gained any insight into the
behaviour of your signal by so-doing however.

> If I want to modify the precision of the fft function, which
> parameter of the .Machine option do I modify, and how?

I do not believe that ``modifying the precision of the fft function''
makes any sense.  In particular the question `` which parameter of
the .Machine option do I modify, and how?'' makes no sense at all as
far as I can discern.  ``.Machine'' is not an ``option'' it is an
object which provides information about the capability of the system
being used to store numerical values.  You cannot modify it --- those
capabilities are what you have, and that is that.

cheers,

Rolf Turner
rolf at math.unb.ca

```