diff options
author | Suraj Yerramilli | 2015-11-01 22:11:02 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-11-01 22:11:02 +0530 |
commit | 53fb51860cc4bdd72ceb1a632013ec11a2173960 (patch) | |
tree | 704570449fb4a6297080db963d1dbee664eebcb6 /R | |
parent | da8737d1c206ddd3a3e86ac2919ab61b5d63e84c (diff) | |
download | SysID-R-code-53fb51860cc4bdd72ceb1a632013ec11a2173960.tar.gz SysID-R-code-53fb51860cc4bdd72ceb1a632013ec11a2173960.tar.bz2 SysID-R-code-53fb51860cc4bdd72ceb1a632013ec11a2173960.zip |
Added support for OE models
Diffstat (limited to 'R')
-rw-r--r-- | R/estpoly.R | 2 | ||||
-rw-r--r-- | R/poly.R | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index 32f4299..fc1d957 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -410,7 +410,7 @@ oe <- function(x,order=c(1,0,1)){ sigma2 <- sum(e^2)/df qx <- qr(X);vcov <- sigma2 * chol2inv(qx$qr) - model <- idpoly(B = theta[1:nb],F = c(1,theta[nb+1:nf]), + model <- idpoly(B = theta[1:nb],F1 = c(1,theta[nb+1:nf]), ioDelay = nk,Ts=deltat(x)) estPoly(coefficients = model,vcov = vcov, sigma = sqrt(sigma2), @@ -29,6 +29,8 @@ print.idpoly <- function(x){ print_arx(x) } else if(x$type=="armax"){ print_armax(x) + } else if(x$type=="oe"){ + print_oe(x) } } @@ -113,3 +115,36 @@ print_armax <- function(obj){ } } +print_oe <- function(obj){ + cat("Discrete-time OE model: y[k] = B(q^{-1})/F(q^{-1}) u[k] + e[k] \n\n") + cat("B(q^{-1}) = ") + for(i in seq_along(obj$B)){ + if(i+obj$ioDelay-1==0){ + cat(obj$B[i]) + } else{ + + if(!((obj$ioDelay!=0) && (i==1))){ + if(obj$B[i]>0) cat(" + ") else cat("- ") + } else{ + if(obj$B[i]<0) cat("-") + } + + if(!(abs(obj$B[i])==1)) cat(abs(obj$B[i])) + cat("q^{-",i+obj$ioDelay-1,"}",sep="") + } + cat("\t") + } + cat("\n") + cat("F(q^{-1}) = ") + for(i in seq_along(obj$F1)){ + if(i-1==0){ + cat(obj$F1[i]) + } else{ + if(obj$A[i]>0) cat(" + ") else cat("- ") + + if(!(abs(obj$F1[i])==1)) cat(abs(obj$F1[i])) + cat("q^{-",i-1,"}",sep="") + } + cat("\t") + } +}
\ No newline at end of file |