# ezfftb

Perform a Fourier synthesis from real and imaginary coefficients.

## Prototype

function ezfftb ( cf : numeric, xbar : numeric ) return_val : float or double

## Arguments

*cf*

Fourier coefficients as created by **ezfftf**.
The elements *cf*(0,...) are the
real coefficients, and *cf*(1,...) are the
imaginary coefficients.

*xbar*

The constant Fourier coefficient. This must be a scalar (or a single
vector of the length of the product of the leftmost dimensions
of *x*).

## Return value

A double array is returned if the input *cf* is
double, otherwise a float array is returned.

If cf(2,kcoef), then **ezfftb** will construct
a one-dimensional series using the coefficients and the
value of *xbar*. The length of the one-dimensional series
may be odd or even depending upon the input coefficients.
If cf(2,N,kcoef), where N refers to one or more dimensions
and xbar(N) then **ezfftb** will construct
a variable, say *x*, that that is of size x(N).

The example will clarify.

## 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 Fourier coefficients *cf* and the series mean(s) *xbar*,
**ezfftb** computes the
periodic sequences and returns an array of length *N* x
*cf@npts*.

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.

**Use ezfftb_n if the dimension to do the
transform across is not the rightmost dimension. This function can
be significantly faster than ezfftb.**

## See Also

**ezfftb_n**,
**ezfftf**,
**ezfftf_n**,
**cfftf**,
**cfftb**

## Examples

**Example 1**

The first example associated with **ezfftf**
performed a Fourier analysis on a series of 24 values.
It produced the real and imaginary coef. The following inputs
(slightly truncated) coefficients to (approximately)
reconstruct the series. Of course, if the full coefficients
had been directly input the original values would be reproduced.

cReal = (/1.34, -13.48, 2.17, 3.29, -5.40, 0.08, \ ; real coef -2.72, 2.70, 2.17,-0.35, 2.95,-1.79 /) cImag = (/3.73, 6.89, 3.36, 0.36, 3.02, 1.00, \ ; imag coef 4.11, 1.52, 2.53,-2.64, 2.81, 0.00 /) cf = (/ (/ cReal /) , (/ cImag /) /) ; (2,12) xbar = 1011.04 ; mean x =ezfftb(cf, xbar) ; Fourier synthesis

**Example 2**

In some instances, it may be appropriate to construct a series about a different mean (commonly, 0.0). The following is the same as Example 1 but reconstruct the series about a mean of 0.0.

X =Here X would be a one-dimensional array containing:ezfftb(cf, 0.0) ; Fourier synthesis

(/ -9.04, 5.96, 6.96, 8.95, 6.95, 15.94, \ 16.95, 18.96, 0.95, 0.94,-29.03, 0.95, \ -10.06,-15.02,-16.02,-0.05, 15.98, 13.96, \ 18.95, 4.96,-15.04,-5.04, -9.02,-29.03 /)

**Example 3**

Let x(ntim,klvl,nlat,mlon) and *N* corresponds to
(ntim,klvl,nlat) in this instance, and mlon is a number of longitude
points:

cf =Reconstruct using only wave 3 and set all the means to 0.0:ezfftf(x) ; ==> cf(2,ntim,klvl,nlat,mlon/2) ; ==> cf@npts = mlon ; ==> cf@xbar ==> contains the means length=ntim*klvl*nlat

cf(:,:,:,:,0:1) = 0.0 ; waves 1 and 2 set to zero cf(:,:,:,:,3:mlon-1) = 0.0 ; waves >3 set to zeroHere cf@xbar will be a one-dimensional array of length ntim*klvl*nlat. We want set all to 0.0 so this is readily done via:

cf@xbar = 0.0 xWave_3 =ezfftb(cf, cf@xbar)