This code is (largely) a port from Matlab to R of the code from 2DSpecTools: A 2D spectral analysis toolkit for Matlab by Taylor Perron et al. As dx and dy refers to spacing in map units, it is recommended, if applicable, that the original raster is projected from latitude, longitude to a planar projection.

fft2D(M, dx, dy, Hann = TRUE)

Arguments

M

a matrix

dx

the spacing in the x direction in map units (usually meters)

dy

the spacing in the y direction in map units (usually meters)

Hann

logical, if TRUE performs a Hann windowing, default to TRUE

Value

a list with 4 elements: spectral_power_matrix, radial_frequency_matrix, spectral_power_vector and radial_frequency_vector.