summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-08-18 18:38:43 +0530
committerSuraj Yerramilli2015-08-18 18:38:43 +0530
commitade9ba68d76f9909eaad24e4ea4cca96a3d1be8c (patch)
tree909306da6c3584e062c9cb2296f67979a0dd9beb /R
parent3d006e5773a3948a4a088990648344cc529f8def (diff)
downloadSysID-R-code-ade9ba68d76f9909eaad24e4ea4cca96a3d1be8c.tar.gz
SysID-R-code-ade9ba68d76f9909eaad24e4ea4cca96a3d1be8c.tar.bz2
SysID-R-code-ade9ba68d76f9909eaad24e4ea4cca96a3d1be8c.zip
Simplified the plot function
Diffstat (limited to 'R')
-rw-r--r--R/idframe.R32
1 files changed, 3 insertions, 29 deletions
diff --git a/R/idframe.R b/R/idframe.R
index b8cd85f..70a275b 100644
--- a/R/idframe.R
+++ b/R/idframe.R
@@ -60,41 +60,15 @@ idframe <- function(output=NULL,input=NULL,Ts = 1,start=0,end=NULL,
#' @export
plot.idframe <- function(object,par=list(mar=c(3,4,2,2)),
col="steelblue",...){
- if(object$type=="frequency"){
- 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),mar=c(3,4,2,2))
- plot(object$frequencies,object$output[,j],xlab=object$type,
- ylab=colnames(object$output)[j],type="l",...)
- plot(object$frequencies,object$input[,i],xlab=object$type,
- ylab=colnames(object$input)[i],type="l",...)
- }
- }
- } else {
- par(mfrow=c(2,1),mar=c(3,4,2,2))
- plot(object$frequencies,object$output[,1],xlab=object$type,
- ylab=colnames(object$output),type="l",...)
- plot(object$frequencies,object$input[,1],xlab=object$type,
- ylab=colnames(object$input),type="l",...)
- }
- } else{
require(tfplot)
- if(is.null(object$output)){
+ if(nrow(object$output)==0){
data <- object$input
- } else if(is.null(object$input)){
+ } else if(nrow(object$input)==0){
data <- object$output
} else{
data <- cbind(object$output,object$input)
}
- datats <- ts(data,start=object$t.start,end=object$t.end,
- frequency=floor(1/object$Ts))
- tfplot(datats,Xaxis=NULL,par=par,col=col,...)
+ tfplot(data,Xaxis=NULL,par=par,col=col,...)
}
}