R/brf_from_frf.R

Defines functions brf_from_frf

Documented in brf_from_frf

#' brf_from_frf
#'
#' Calculate the barometric response function from the transfer function
#'
#' @param x the complex transfer function vector
#'
#' @return vector of the barometric response function
#' 
#' @export
#'
brf_from_frf <- function(x) {
  
  n <- floor(length(x) / 2) + 1
  
  imp <- fftw::IFFT(x, scale = TRUE)
  imp <- Mod(imp) * sign(Re(imp))
  
  cumsum(rev(imp)[1:n] + (imp)[1:n])
  
}
jkennel/waterlevel documentation built on Dec. 1, 2019, 6:24 p.m.