summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-12-28 16:51:24 +0530
committerSuraj Yerramilli2015-12-28 16:51:24 +0530
commitdbd70f54f1d08d56f1c7ef4148e710ac60212758 (patch)
tree0f268072654b173a0fb1197c39bc6f1cf3f328b0 /R
parent25afd972bbd0a6e26de3284b166383d2d7ff65ab (diff)
downloadSysID-R-code-dbd70f54f1d08d56f1c7ef4148e710ac60212758.tar.gz
SysID-R-code-dbd70f54f1d08d56f1c7ef4148e710ac60212758.tar.bz2
SysID-R-code-dbd70f54f1d08d56f1c7ef4148e710ac60212758.zip
Added standard error printing function for idpoly objects
Diffstat (limited to 'R')
-rw-r--r--R/poly.R15
1 files changed, 14 insertions, 1 deletions
diff --git a/R/poly.R b/R/poly.R
index 4aad013..420d83b 100644
--- a/R/poly.R
+++ b/R/poly.R
@@ -54,7 +54,7 @@ checkUnity <- function(x){
}
#' @export
-print.idpoly <- function(mod,...){
+print.idpoly <- function(mod,se=NULL,...){
if(mod$type=="arx"){
cat("Discrete-time ARX mod: A(q^{-1})y[k] = B(q^{-1})u[k] + e[k] \n\n")
@@ -68,6 +68,14 @@ print.idpoly <- function(mod,...){
cat("Discrete-time Polynomial mod: A(q^{-1}) y[k] = B(q^{-1})/F(q^{-1}) u[k] + C(q^{-1})/D(q^{-1}) e[k] \n\n")
}
+ # Printing Standard error sequence
+ j=1
+ print_se <- function(se){
+ if(!is.null(se)){
+ cat(" (+/- ",se[j],") ",sep = "")
+ j <<- j+1
+ }
+ }
if(length(mod$A)>1){
cat("A(q^{-1}) = ")
@@ -78,6 +86,7 @@ print.idpoly <- function(mod,...){
if(mod$A[i]>0) cat(" + ") else cat("- ")
if(!(abs(mod$A[i])==1)) cat(abs(mod$A[i]))
+ print_se(se)
cat("q^{-",i-1,"}",sep="")
}
cat("\t")
@@ -98,6 +107,7 @@ print.idpoly <- function(mod,...){
}
if(!(abs(mod$B[i])==1)) cat(abs(mod$B[i]))
+ print_se(se)
cat("q^{-",i+mod$ioDelay-1,"}",sep="")
}
cat("\t")
@@ -113,6 +123,7 @@ print.idpoly <- function(mod,...){
if(mod$C[i]>0) cat(" + ") else cat("- ")
if(!(abs(mod$C[i])==1)) cat(abs(mod$C[i]))
+ print_se(se)
cat("q^{-",i-1,"}",sep="")
}
cat("\t")
@@ -129,6 +140,7 @@ print.idpoly <- function(mod,...){
if(mod$D[i]>0) cat(" + ") else cat("- ")
if(!(abs(mod$D[i])==1)) cat(abs(mod$D[i]))
+ print_se(se)
cat("q^{-",i-1,"}",sep="")
}
cat("\t")
@@ -145,6 +157,7 @@ print.idpoly <- function(mod,...){
if(mod$F1[i]>0) cat(" + ") else cat("- ")
if(!(abs(mod$F1[i])==1)) cat(abs(mod$F1[i]))
+ print_se(se)
cat("q^{-",i-1,"}",sep="")
}
cat("\t")