Next Previous Contents

## 8. fft.ct

This section describes functions from file fft.ct.

## 8.1 cosFFT

> `

>     [f] = cosFFT(u; dim)
>      cosFFT(u) gives the cosine Fast Fourier Transform of array u.
>        If u's rank is more than one, the transform is computed
>        only along the first dimension (many independent 1D
>        transforms).

>        cosFFT(u,dim) computes the FFT along the specified dimension.
>        The first dimension is labeled 1 and so on.

>        For vector u, f=cosFFT(u) is equivalent with

>        n = length(u); f = zeros(n);
>        for (j=1; j<=n; j++)
>            f[j] = u[1] - (-1)^j*u[n] + 2*sum(u[2:n-1]*cos((1:n-2)*(j-1)*pi/(n-1)));

>        Note that cosFFT is most efficient when n-1 is a product of small
>        primes, where n is the transform length.

> See also: invcosFFT, sinFFT, cosqFFT, sinqFFT, realFFT, FFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.2 cosqFFT

> `

>     [f] = cosqFFT(u; dim)
>      cosqFFT computes the quarter-wave cosine Fourier transform.
>        Except for the quarter-wave cosine character, it works similarly to cosFFT.

>        For vector u, f=cosqFFT(u) is equivalent with

>        n = length(u); f = zeros(n);
>        for (j=1; j<=n; j++)
>            f[j] = u[1] + 2*sum(u[2:n]*cos((2*j-1)*(1:n-1)*pi/(2*n)));

>        cosqFFT is most efficient when the transform length is a product
>        of small primes.

> See also: invcosqFFT, realFFT, sinqFFT, FFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.3 invcosFFT

> `

>     [f] = invcosFFT(u; dim)
>      invcosFFT() is the inverse of cosFFT().
>        Actually invcosFFT differs from cosFFT only by normalization,
>        but it is provided as a separate function for convenience.

>        For vector f, u=invcosFFT(f) is equivalent with

>        n = length(f); u = zeros(n);
>        for (j=1; j<=n; j++)
>            u[j] = (f[1] - (-1)^j*f[n] + 2*sum(f[2:n-1]*cos((1:n-2)*(j-1)*pi/(n-1))))/(2*n-2)

> See also: cosFFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.4 invcosqFFT

> `

>     [f] = invcosqFFT(u; dim)
>      invcosqFFT() is the inverse of cosqFFT()
>        (inverse quarter-wave cosine Fourier transform).

>        For vector f, u=invcosqFFT(f) is equivalent with

>        n = length(f); u = zeros(n);
>        for (j=1; j<=n; j++)
>            u[j] = (1/n)*sum(f*cos((2*(1:n)-1)*(j-1)*pi/(2*n)));

> See also: cosqFFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.5 invsinFFT

> `

>     [f] = invsinFFT(u; dim)
>      invsinFFT() is the inverse of sinFFT().
>        Actually invsinFFT differs from sinFFT only by normalization,
>        but it is provided as a separate function for convenience.

>        For vector f, u=invsinFFT(f) is equivalent with

>        n = length(f); u = zeros(n);
>        for (j=1; j<=n; j++)
>            u[j] = (1/(n+1))*sum(f*sin((1:n)*j*pi/(n+1)));

> See also: sinFFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.6 invsinqFFT

> `

>     [f] = invsinqFFT(u; dim)
>      invsinqFFT() is the inverse of sinqFFT()
>        (inverse quarter-wave sine Fourier transform).

>        For vector f, u=invsinqFFT(f) is equivalent with

>        n = length(f); u = zeros(n);
>        for (j=1; j<=n; j++)
>            u[j] = (1/n)*sum(f*sin((2*(1:n)-1)*j*pi/(2*n)));

> See also: sinqFFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.7 sinFFT

> `

>     [f] = sinFFT(u; dim)
>      sinFFT(u) gives the sine Fast Fourier Transform of array u.
>        If u's rank is more than one, the transform is computed
>        only along the first dimension (many independent 1D
>        transforms).

>        sinFFT(u,dim) computes the FFT along the specified dimension.
>        The first dimension is labeled 1 and so on.

>        For vector u, f=sinFFT(u) is equivalent with

>        n = length(u); f = zeros(n);
>        for (j=1; j<=n; j++)
>            f[j] = 2*sum(u*sin((1:n)*j*pi/(n+1)));

>        Note that sinFFT is the most efficient when n+1 is a product of
>        small primes, where n is the transform length.

> See also: invsinFFT, cosFFT, sinqFFT, cosqFFT, realFFT, FFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

## 8.8 sinqFFT

> `

>     [f] = sinqFFT(u; dim)
>      sinqFFT computes the quarter-wave sine Fourier transform of array u.
>        Except for the quarter-wave sine character, it works similarly to sinFFT.

>        For vector u, f=sinqFFT(u) is equivalent with

>        n = length(u); f = zeros(n);
>        for (j=1; j<=n; j++)
>            f[j] = (-1)^(j-1)*u[n] + 2*sum(u[1:n-1]*sin((2*j-1)*(1:n-1)*pi/(2*n)));

>        sinqFFT is most efficient when the transform length is a product
>        of small primes.

> See also: invsinqFFT, realFFT, cosqFFT, FFT.

>        Error codes:
>        -1: First argument not a real array
>        -2: Second argument not integer
>        -3: Second argument out of range

> `

Next Previous Contents