Learn R Programming

spate (version 1.7.5)

real.fft: Fast calculation of the two-dimensional real Fourier transform.

Description

Fast calculation of the real Fourier transform. This is a wrapper function for a C function which uses the complex FFT function from the 'fftw3' library.

Usage

real.fft(w,n,inv=TRUE,indFFT=NULL)

Value

A vector of length n*n containing the real (inverse) Fourier transformation of 'w'.

Arguments

w

A spatial field in a stacked vector of length N=n^2.

n

Number of grid points on each axis. n x n is the total number of spatial points.

inv

Indicates whether the inverse Fourier transform should be calculated or not.

indFFT

A list of containing vectors of natural numbers representing indices used to transform between the real and the complex Fourier transform.

Author

Fabio Sigrist

Examples

Run this code
n <- 100
spec <- matern.spec(wave=spate.init(n=n,T=1)$wave,n=n,rho0=0.05,sigma2=1,norm=TRUE)
sim <- real.fft(sqrt(spec)*rnorm(n*n),n=n,inv=FALSE)
image(1:n,1:n,matrix(sim,nrow=n),main="Sample from Matern field",xlab="",ylab="")

Run the code above in your browser using DataLab