summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-03 15:07:10 +0530
committerSuraj Yerramilli2015-06-03 15:07:10 +0530
commitbe3afe5d33b3e557f7a5d0c0313761fabbfd7607 (patch)
tree4fbadfd016bd7e8ebb18d1a9c15f0770f1aed850
parente729a99049105bf72b79c6d07493fc83146bf84d (diff)
downloadSysID-R-code-be3afe5d33b3e557f7a5d0c0313761fabbfd7607.tar.gz
SysID-R-code-be3afe5d33b3e557f7a5d0c0313761fabbfd7607.tar.bz2
SysID-R-code-be3afe5d33b3e557f7a5d0c0313761fabbfd7607.zip
Added Minor Changes
-rw-r--r--R/nonparam.R18
1 files changed, 5 insertions, 13 deletions
diff --git a/R/nonparam.R b/R/nonparam.R
index 81ca580..7ddf49b 100644
--- a/R/nonparam.R
+++ b/R/nonparam.R
@@ -87,29 +87,21 @@ step <- function(model){
abline(h=0)
}
+#'
#' Estimate frequency response
#'
#' Estimates Frequency Response with fixed frequency resolution using
#' spectral analysis
#'
#' @export
-spa <- function(data,WinSize=NULL){
+spa <- function(data,npad=255){
require(sapa)
- temp <- cbind(data$y,data$u)
+ temp <- cbind(data$output,data$input)
# Non-parametric Estimation of Spectral Densities -
# WOSA and Hanning window
-
- if(is.null(WinSize)){
- M <- min(dim(temp,1),30)
- } else{
- M <- WinSize
- }
-
- gamma <- SDF(temp,method="wosa",sampling.interval = data$Ts,
- taper. = taper(type="hanning",n.sample=M))
- out <- list(response = gamma[,2]/gamma[,3])
- class(out) <- "spa"
+ gamma <- SDF(temp,method="wosa",sampling.interval = data$Ts,npad=npad)
+ out <- list(response = gamma[,2]/gamma[,3],spec=gamma)
return(out)
}