R/fftshift.R

Defines functions fftshift1D2D

Documented in fftshift1D2D

# Shift zero-frequency component to center of spectrum
# When applying FT for discrete data, the multiplication 
# shifts the spectrum of the signal by half the sampling frequency
# ==> the zero frequency that was at 0 is now at half width

fftshift1D2D <- function(x) {
  vec <- FALSE
  if (is.vector(x)) {
    x <- vec2mat(x)
    vec <- TRUE
  }
  m <- dim(x)[2]
  p <- ceiling(m/2)
  new_index <- c((p + 1):m, 1:p)
  y <- x[, new_index, drop = vec]
}

Try the PepsNMR package in your browser

Any scripts or data that you put into this service are public.

PepsNMR documentation built on Jan. 16, 2021, 2:07 a.m.