diff options
author | Suraj Yerramilli | 2016-03-22 10:47:15 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-03-22 10:47:15 +0530 |
commit | ba996f8628777cb4d448f5b7f5aac1e35ce060b0 (patch) | |
tree | e5e2400deb2a3b10e394765ff5dee07789ac6a3c | |
parent | 3fb63299a4d3b1cf748d3414a4fc6ff8f4e23368 (diff) | |
download | SysID-R-code-ba996f8628777cb4d448f5b7f5aac1e35ce060b0.tar.gz SysID-R-code-ba996f8628777cb4d448f5b7f5aac1e35ce060b0.tar.bz2 SysID-R-code-ba996f8628777cb4d448f5b7f5aac1e35ce060b0.zip |
support for fir estimation in arx routine
-rw-r--r-- | R/estpoly.R | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index c15dc80..6589291 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -195,6 +195,7 @@ arx <- function(x,order=c(1,1,1),lambda=0.1,intNoise=FALSE, fixedpos_B <- which(!is.na(fixed[[2]])) uindex <- uindex[!uindex %in% (nk+fixedpos_B-1)] + fixedpos_A <- numeric(0) if(na!=0){ fixedpos_A <- which(!is.na(fixed[[1]])) yindex <- yindex[!yindex %in% fixedpos_A] @@ -202,8 +203,12 @@ arx <- function(x,order=c(1,1,1),lambda=0.1,intNoise=FALSE, } reg <- function(i) { - phi <- t(c(-yout[i-yindex,],uout[i-uindex,])) + # regressor + temp <- numeric(0) + if(na!=0) temp <- c(temp,-yout[i-yindex,]) + phi <- t(c(temp,uout[i-uindex,])) l <- list(phi=phi) + # fixed regressors if(!fixedflag){ temp <- numeric(0) if(length(fixedpos_A)!=0){ @@ -249,7 +254,8 @@ arx <- function(x,order=c(1,1,1),lambda=0.1,intNoise=FALSE, temp2[eindex,eindex] <- vcov; vcov <- temp2 } - model <- idpoly(A = c(1,coef[1:na]),B = coef[na+1:nb], + A = ifelse(na==0,1,coef[1:na]) + model <- idpoly(A = A,B = coef[na+1:nb], ioDelay = nk,Ts=deltat(x),noiseVar = sqrt(sigma2), intNoise=intNoise,unit=x$unit) |