diff options
author | Suraj Yerramilli | 2015-01-19 22:49:38 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-01-19 22:49:38 +0530 |
commit | 46ebfafb39d84892c7aee785edff0fab289f50c3 (patch) | |
tree | 321b5902c70cd1cc9c499ab1599087b009481a8c | |
parent | a86211c3abe75ca95d80753362800b207fa8ceec (diff) | |
download | SysID-R-code-46ebfafb39d84892c7aee785edff0fab289f50c3.tar.gz SysID-R-code-46ebfafb39d84892c7aee785edff0fab289f50c3.tar.bz2 SysID-R-code-46ebfafb39d84892c7aee785edff0fab289f50c3.zip |
added plot function (needs to be tested)
-rw-r--r-- | R/idframe.R | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/R/idframe.R b/R/idframe.R index be25184..478c4d8 100644 --- a/R/idframe.R +++ b/R/idframe.R @@ -53,12 +53,42 @@ idframe <- function(output=data.frame(numeric(0)),input=data.frame(numeric(0)), # print method for idframe class print.idframe <- function(object,...){ - + print(object) } # plot method for idframe object plot.idframe <- function(object,...){ + p <- dim(object$output)[2];m <- dim(object$input)[2] + + if(p!=1 && m!=1){ + oask <- devAskNewPage(TRUE) + on.exit(devAskNewPage(oask)) + + for(i in seq(m)){ + for(j in seq(p)){ + par(mfrow=c(2,1)) + plot(.index(object),object$output[,p],xlab=object$type, + ylab=colnames(object$output)[p],type="l",...) + plot(.index(object),object$input[,m],xlab=object$type, + ylab=colnames(object$input)[m],type="l",...) + } + } + } else { + par(mfrow=c(2,1)) + plot(.index(object),object$output[,1],xlab=object$type, + ylab=colnames(object$output),type="l",...) + plot(.index(object),object$input[,1],xlab=object$type, + ylab=colnames(object$input),type="l",...) + } +} + +.index <- function(object){ + if(object$type=="time"){ + return(seq(from=object$tStart,to=object$tEnd,by=object$Ts)) + } else { + return(object$frequencies) + } } # summary method for idframe object |