NCL Home > Documentation > Functions > General applied math

# ezfftf

Perform a Fourier analysis on a real periodic sequence.

## Prototype

```	function ezfftf (
x  : numeric
)

return_val  :   typeof(x)
```

## Arguments

x

A variable containing one or more periodic sequences to be transformed. For a multi-dimensional array the rightmost dimension will be transformed. The size of the rightmost dimension need not be a power of 2.

## Return value

A double array is returned if x is double, otherwise a float array is returned.

If npts is the size of the dimension to be transformed, and N represents all other variable dimensions, then the fourier coefficients are returned as an variable dimensioned 2 x N x (npts/2). The leftmost dimension of size 2 contains the real and imaginary coefficients.

It also returns the series mean(s) as an attribute called xbar. A second attribute, npts, specifies the length of the original series.

The examples clarify the above information.

## Description

There's a bug in V6.1.2 and earlier of this function in which if "npts" is odd, the wrong values are returned. This is fixed in V6.2.0.

Given a real periodic sequence x, ezfftf performs a forward Fourier transform. This is often called Fourier Analysis.

The "ez" preface is a mnemonic for the word 'easy'. The ezfftf and ezfftb were created to allow people not comfortable or familiar with complex functions to derive and use the FFT coefficients. They are returned as two parts: real (cosine) and imaginary (sine).

ezfftf is a direct call to the FFTPACK routine at

```    http://www.netlib.org/fftpack/ezfftf.f
```

If any missing values are encountered in one of the input arrays, then no calculations will be performed on that array, and the corresponding output array will be filled with missing values.

The user may wish to detrend [ dtrend ] and taper prior to performing the analysis. Consult a book on Fourier Analysis for details. A old but nice reference is:

```        Peter Bloomfield
Fourier Analysis of Time Series : An Introduction
New York : John Wiley and Sons  , 1976
```

Use ezfftf_n if the dimension to do the transform across is not the rightmost dimension. This function can be significantly faster than ezfftf.