diff options
author | Suraj Yerramilli | 2015-08-23 16:45:31 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2015-08-23 16:45:31 +0530 |
commit | 8cf11e87a1c30bc5354d245660461195fcbde932 (patch) | |
tree | 98d67484484f93fa4d1f26356b3a747c01805804 | |
parent | fc5b9c365a4ac75137327731df09fa866aaa2d54 (diff) | |
download | SysID-R-code-8cf11e87a1c30bc5354d245660461195fcbde932.tar.gz SysID-R-code-8cf11e87a1c30bc5354d245660461195fcbde932.tar.bz2 SysID-R-code-8cf11e87a1c30bc5354d245660461195fcbde932.zip |
Added multivariate plot support
-rw-r--r-- | R/nonparam.R | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/R/nonparam.R b/R/nonparam.R index cebc1ab..068f9b7 100644 --- a/R/nonparam.R +++ b/R/nonparam.R @@ -46,6 +46,8 @@ impulseest <- function(x,M=30,K=NULL,regul=F,lambda=1){ K[index],regul,lambda) } } + out$ninputs <- nInputSeries(x) + out$noutputs <- nOutputSeries(x) class(out) <- "impulseest" return(out) } @@ -87,15 +89,22 @@ impulsechannel <- function(y,u,N,M,K=0,regul=F,lambda=1){ #' @seealso \code{\link{impulseest}},\code{\link{step}} #' @export plot.impulseest <- function(model,sig=0.975){ - lim <- model$se*qnorm(0.975) + par(mfrow=c(model$noutputs,model$ninputs)) - ylim <- c(min(coef(model)),max(coef(model))) + impulseplot <- function(model,sig){ + lim <- model$se*qnorm(sig) + + ylim <- c(min(coef(model)),max(coef(model))) + + title <- paste("Impulse Response \n From",model$x,"to",model$y) + plot(model$lags,coef(model),type="h",xlab="Lag",ylab= "IR Coefficient", + main = title) + abline(h=0);points(x=model$lags,y=lim,col="blue",lty=2,type="l") + points(x=model$lags,y=-lim,col="blue",lty=2,type="l") + } - title <- paste("Impulse Response \n From",model$x,"to",model$y) - plot(model$lags,coef(model),type="h",xlab="Lag",ylab= "IR Coefficient", - main = title) - abline(h=0);points(x=model$lags,y=lim,col="blue",lty=2,type="l") - points(x=model$lags,y=-lim,col="blue",lty=2,type="l") + l <- model[seq(model$noutputs*model$ninputs)] + p <- lapply(l,impulseplot,sig=sig) } |