diff options
author | Suraj Yerramilli | 2015-09-04 10:24:49 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-09-04 10:24:49 +0530 |
commit | 01531784e9cb874d948c47d445c52c558a2735d2 (patch) | |
tree | 8fb9badbdcfdea1e40efc3a3edd52ed697354013 | |
parent | e7da35a333067e4bdad23e82e002e4c499afc3b6 (diff) | |
download | SysID-R-code-01531784e9cb874d948c47d445c52c558a2735d2.tar.gz SysID-R-code-01531784e9cb874d948c47d445c52c558a2735d2.tar.bz2 SysID-R-code-01531784e9cb874d948c47d445c52c558a2735d2.zip |
corrected the phase in spa
-rw-r--r-- | R/nonparam.R | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/R/nonparam.R b/R/nonparam.R index 7df30d9..4d8496a 100644 --- a/R/nonparam.R +++ b/R/nonparam.R @@ -175,9 +175,11 @@ spa <- function(data,npad=255){ # Non-parametric Estimation of Spectral Densities - # WOSA and Hanning window - gamma <- SDF(temp,method="wosa",sampling.interval = data$Ts,npad=npad) - freq <- seq(from=1,to=ceiling(npad/2),by=1)/ceiling(npad/2)*pi/data$Ts - out <- idfrd(response = gamma[,2]/gamma[,3],freq=freq,Ts= data$Ts) + gamma <- SDF(temp,method="wosa",sampling.interval = deltat(data), + npad=npad) + freq <- attributes(gamma)$frequency*2*pi + out <- idfrd(response = Conj(gamma[,2])/Mod(gamma[,3]),freq=freq, + Ts= deltat(data)) return(out) } |