summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-03-18 12:55:26 +0530
committerSuraj Yerramilli2016-03-18 12:55:26 +0530
commita5021c007c6f4668aa284cf3100b38c1b649fa04 (patch)
tree5c92f34e306a7a11351dbd1a682a8bd4530e4d56
parent7c9e87890244ec54f3ce8f4fe53dd08d8bbe8d4f (diff)
downloadSysID-R-code-a5021c007c6f4668aa284cf3100b38c1b649fa04.tar.gz
SysID-R-code-a5021c007c6f4668aa284cf3100b38c1b649fa04.tar.bz2
SysID-R-code-a5021c007c6f4668aa284cf3100b38c1b649fa04.zip
print routine accommodates integrated noise models
-rw-r--r--R/poly.R30
1 files changed, 18 insertions, 12 deletions
diff --git a/R/poly.R b/R/poly.R
index bfdaf08..2c29b3f 100644
--- a/R/poly.R
+++ b/R/poly.R
@@ -69,20 +69,26 @@ checkUnity <- function(x){
#' @export
print.idpoly <- function(mod,se=NULL,dig=3){
-
- if(mod$type=="arx"){
- cat("Discrete-time ARX model: A(z)y[k] = B(z)u[k] + e[k] \n\n")
- } else if(mod$type=="fir"){
- cat("Discrete-time FIR model: y[k] = B(z)u[k] + e[k] \n\n")
- } else if(mod$type=="armax"){
- cat("Discrete-time ARMAX model: A(z)y[k] = B(z)u[k] + C(z)e[k] \n\n")
- } else if(mod$type=="oe"){
- cat("Discrete-time OE model: y[k] = B(z)/F(z) u[k] + e[k] \n\n")
- } else if(mod$type=="bj"){
- cat("Discrete-time BJ model: y[k] = B(z)/F(z) u[k] + C(z)/D(z) e[k] \n\n")
+ main <- paste("Discrete-time",toupper(mod$type),"model:")
+ if(mod$type=="oe" || mod$type=="bj"){
+ main <- paste(main,"y[k] = B(z)/F(z) u[k] +")
+ if(mod$type=="bj"){
+ polyExp <- ifelse(!checkUnity(mod$C),"C(z)/D(z)","1/D(z)")
+ if(mod$intNoise==T) polyExp <- paste(polyExp,"1/(1-z^{-1})")
+ main <- paste(main,polyExp,"e[k] \n\n")
+ }
} else{
- cat("Discrete-time Polynomial model: A(z) y[k] = B(z)/F(z) u[k] + C(z)/D(z) e[k] \n\n")
+ main <- paste(main,"A(z)y[k] =")
+ if(!checkUnity(mod$B)) main <- paste(main,"B(z)u[k] +")
+ if(checkUnity(mod$C)){
+ Cexp <- ifelse(mod$intNoise==T,"","1/(1-z^{-1})")
+ }else{
+ Cexp <- "C(z)"
+ if(mod$intNoise==T) Cexp <- paste(Cexp,"/(1-z^{-1})",sep="")
+ }
+ main <- paste(main,Cexp,"e[k] \n\n")
}
+ cat(main)
# Printing Standard error sequence
j=1