summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-11-01 22:11:02 +0530
committerSuraj Yerramilli2015-11-01 22:11:02 +0530
commit53fb51860cc4bdd72ceb1a632013ec11a2173960 (patch)
tree704570449fb4a6297080db963d1dbee664eebcb6 /R
parentda8737d1c206ddd3a3e86ac2919ab61b5d63e84c (diff)
downloadSysID-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.R2
-rw-r--r--R/poly.R35
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),
diff --git a/R/poly.R b/R/poly.R
index 9880c00..e792fba 100644
--- a/R/poly.R
+++ b/R/poly.R
@@ -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