https://github.com/cran/fda
Raw File
Tip revision: 5da7c7f94ac22930be427c9f326196e0359a92da authored by J. O. Ramsay on 03 October 2008, 00:00:00 UTC
version 2.0.4
Tip revision: 5da7c7f
deriv.fd.R
deriv.fd <- function(expr, Lfdobj=int2Lfd(1), ...)
{
  #  Applies linear differential operator LFD to functional data object FD
  #    and returns the result as functional data object DERIVFD.

# Last modified 2007 May 3 by Spencer Graves  
  #  Previously modified 26 October 2005

  fdobj <- expr
  if (!inherits(fdobj, "fd")) stop(
		"Argument  FD not a functional data object.")
		
  Lfdobj   <- int2Lfd(Lfdobj)

  basisobj <- fdobj$basis
  nbasis   <- basisobj$nbasis
  rangeval <- basisobj$rangeval

  evalarg  <- seq(rangeval[1], rangeval[2], len=10*nbasis+1)
  Lfdmat   <- eval.fd(evalarg, fdobj, Lfdobj)

  Lfdcoef  <- project.basis(Lfdmat, evalarg, basisobj)

  Dfdnames <- fdobj$fdnames
  Dfdnames[[3]] <- paste("D",Dfdnames[[3]])

  Dfdobj <- fd(Lfdcoef, basisobj, Dfdnames)

  return(Dfdobj)
}
back to top