Description Usage Arguments Details Value Author(s) See Also Examples
Function to compute the Fast Fourier Transform (FFT) of a gridded field. The field is first expanded, and zero padded.
1 |
x |
n by m matrix giving the gridded field to transform. |
bigdim |
(optional) numeric vector of length 2. If NULL, it will be found from kdim. One of this argument or kdim must be given. |
kdim |
(optional) numeric vector of length 2 giving the dimension of the kernel to be applied. If bigdim is NULL, then the optimal dimension for the FFT is calculated from the dimension of x and kdim. |
The gridded field is expanded to bigdim, which is the nearest power of 2 above N=dim( x) + kdim - 1 if N <= 1024, or to the nearest multiple of 512 otherwise, if bigdim is not supplied. x
is placed in the upper left corner of a matrix of zeros that has dimension bigdim. Missing values are replaced by zero. The FFT is conducted on the expanded/zero-padded gridded field. This is intended to be used more internally for the kernel2dsmooth
function in order to reduce the number of FFT's that need be calculated (e.g., if performed for the same threshold over several neighborhood lengths). It is currently not used by SpatialVx function anymore, but may still be usefull.
A possibly complex matrix of size bigdim of the Fourier transformed gridded field is returned.
Eric Gilleland
fft
, kernel2dsmooth
, kernel2dmeitsjer
1 2 3 4 5 6 7 8 9 10 11 | look <- matrix( 0, 10, 12)
look[4,7] <- 1
lookFFT <- Fourier2d( look, kdim=c(3,3))
# Now, call 'kernel2dsmooth' with a neighborhood boxcar kernel that averages the
# nearest grid squares (i.e., neighborhood length of 3). That is, a square
# of 1/(3^2) = 1/9 ~ 0.111111 with length 3 surrounding the 1 in 'look'.
kernel2dsmooth( look, kernel.type="boxcar", n=3, X=lookFFT)
# Note that the above could have been done with just:
kernel2dsmooth( look, kernel.type="boxcar", n=3)
# But, in the previous one, one less FFT was calculated.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.