diff options
author | Suraj Yerramilli | 2015-06-04 00:12:46 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-06-04 00:12:46 +0530 |
commit | b53df53ac864cf26507b4c7e49949b89f691447a (patch) | |
tree | e8f5b42c4dd5efff4a0d54ad690f82246262af23 /R/nonparam.R | |
parent | ed71be1ff54ea4eac16bf22785e207e7c45d6d4f (diff) | |
download | SysID-R-code-b53df53ac864cf26507b4c7e49949b89f691447a.tar.gz SysID-R-code-b53df53ac864cf26507b4c7e49949b89f691447a.tar.bz2 SysID-R-code-b53df53ac864cf26507b4c7e49949b89f691447a.zip |
Corrected the etfe function
Diffstat (limited to 'R/nonparam.R')
-rw-r--r-- | R/nonparam.R | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/R/nonparam.R b/R/nonparam.R index 892027b..d7a6162 100644 --- a/R/nonparam.R +++ b/R/nonparam.R @@ -87,7 +87,6 @@ step <- function(model){ abline(h=0) } -#' #' Estimate frequency response #' #' Estimates Frequency Response with fixed frequency resolution using @@ -112,12 +111,12 @@ spa <- function(data,npad=255){ #' #' @export etfe <- function(data){ - require(sapa) temp <- cbind(as.ts(data$output),as.ts(data$input)) tempfft <- mvfft(temp)/dim(temp)[1] - freq <- seq(from=1,to=dim(temp)[1],by=1)/dim(temp)[1]*pi/data$Ts - - out <- idfrd(response=as.complex(tempfft[,1]/tempfft[,2]),freq=freq, + freq <- seq(from=1,to=ceiling(dim(tempfft)[1]/2), + by=1)/ceiling(dim(tempfft)[1]/2)*pi/data$Ts + resp <- as.complex(tempfft[,1]/tempfft[,2]) + out <- idfrd(response=resp[1:ceiling(length(resp)/2)],freq=freq, Ts=data$Ts) return(out) -} +}
\ No newline at end of file |