summaryrefslogtreecommitdiff
path: root/R/nonparam.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-03 12:16:17 +0530
committerSuraj Yerramilli2015-06-03 12:16:17 +0530
commit6eedf002e8d399e4ac8c08037653f74a016fc7e4 (patch)
treef9767625103128c612b52391b62dfd63315ccf96 /R/nonparam.R
parentc36d770f1425821033bc831d790345c77dcb9843 (diff)
downloadSysID-R-code-6eedf002e8d399e4ac8c08037653f74a016fc7e4.tar.gz
SysID-R-code-6eedf002e8d399e4ac8c08037653f74a016fc7e4.tar.bz2
SysID-R-code-6eedf002e8d399e4ac8c08037653f74a016fc7e4.zip
added code to compute the frf using WOSA
Diffstat (limited to 'R/nonparam.R')
-rw-r--r--R/nonparam.R16
1 files changed, 16 insertions, 0 deletions
diff --git a/R/nonparam.R b/R/nonparam.R
index b3110ec..fcc1e20 100644
--- a/R/nonparam.R
+++ b/R/nonparam.R
@@ -91,7 +91,23 @@ step <- function(model){
#' spectral analysis
#'
spa <- function(data,WinSize=NULL){
+ require(sapa)
+ temp <- cbind(data$y,data$u)
+ # Non-parametric Estimation of Spectral Densities -
+ # WOSA and Hanning window
+
+ if(WinSize==NULL){
+ M <- min(dim(temp,1),30)
+ } else{
+ M <- WinSize
+ }
+
+ gamma <- SDF(temp,method="wosa",
+ taper. = taper(type="hanning",n.sample=M))
+ out <- list(response = gamma[,2]/gamma[,3])
+ class(out) <- "spa"
+ return(out)
}
#' Estimate empirical transfer function