summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-09-04 10:24:49 +0530
committerSuraj Yerramilli2015-09-04 10:24:49 +0530
commit01531784e9cb874d948c47d445c52c558a2735d2 (patch)
tree8fb9badbdcfdea1e40efc3a3edd52ed697354013
parente7da35a333067e4bdad23e82e002e4c499afc3b6 (diff)
downloadSysID-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.R8
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)
}