Home > wafo > kdetools > fftce.m

fftce

PURPOSE

Circulant Embedding of a vector or matrix

y = fftce(x)

DESCRIPTION

```  FFTCE  Circulant Embedding of a vector or matrix

CALL: y = fftce(x);

y = circulant embedded vector or matrix (2*size(x)-1)
x = vector or matrix

For vectors, Y = X([1:M M-1:-1:2])
For matrices, X is copied into the first quadrant of Y
and Mi-1 on to the 2'nd, 3'rd and 4'th quadrant of Y.
For N-D arrays, X is copied into  "half-spaces" of Y along each
dimension.

FFTCE is useful for circulant embedding of vectors and matrices
when working with the Fourier transform.

CROSS-REFERENCE INFORMATION

This function calls:
 cell Create cell array.
This function is called by:
 kdebin Binned Kernel Density Estimator.

SOURCE CODE

```001 function y = fftce(x)
002 % FFTCE  Circulant Embedding of a vector or matrix
003 %
004 % CALL: y = fftce(x);
005 %
006 %   y = circulant embedded vector or matrix (2*size(x)-1)
007 %   x = vector or matrix
008 %
009 %   For vectors, Y = X([1:M M-1:-1:2])
010 %   For matrices, X is copied into the first quadrant of Y
011 %   and Mi-1 on to the 2'nd, 3'rd and 4'th quadrant of Y.
012 %   For N-D arrays, X is copied into  "half-spaces" of Y along each
013 %   dimension.
014 %
015 %   FFTCE is useful for circulant embedding of vectors and matrices
016 %   when working with the Fourier transform.
017 %
019
020 % tested on: matlab 5.2
021 % history:
022 % by pab 5.11.1999
023
024 numDims = ndims(x);
025 idx = cell(1, numDims);
026 for k = 1:numDims
027     m = size(x, k);
028     idx{k} = [1:m m-1:-1:2];
029     %idx{k} = [1:m m:-1:2];
030 end
031
032 % Use comma-separated list syntax for N-D indexing.
033 y = x(idx{:});
034```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003