diff options
author | Suraj Yerramilli | 2016-01-03 09:48:05 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-01-03 09:48:05 +0530 |
commit | 38f94134e67fcb66cbf70db3074fa36bcff5f1a4 (patch) | |
tree | afe5ca4a43d41e3fc4d9fef0e9097ab564b2239c /R | |
parent | d27528061368ba511f0a0bed9316d26554ca4fd9 (diff) | |
download | SysID-R-code-38f94134e67fcb66cbf70db3074fa36bcff5f1a4.tar.gz SysID-R-code-38f94134e67fcb66cbf70db3074fa36bcff5f1a4.tar.bz2 SysID-R-code-38f94134e67fcb66cbf70db3074fa36bcff5f1a4.zip |
added predict routine for idpoly objects
Diffstat (limited to 'R')
-rw-r--r-- | R/estpoly.R | 13 | ||||
-rw-r--r-- | R/poly.R | 13 |
2 files changed, 19 insertions, 7 deletions
diff --git a/R/estpoly.R b/R/estpoly.R index 2fa4351..25a65d2 100644 --- a/R/estpoly.R +++ b/R/estpoly.R @@ -67,16 +67,15 @@ predict.estpoly <- function(x,newdata=NULL,nahead=1){ if(is.null(newdata)&&nahead=1){ return(fitted(x)) } else{ - mod <- x$sys + model <- x$sys if(is.null(newdata)){ - y <- fitted(mod)+resid(mod) - u <- mod$input + y <- fitted(x)+resid(x) + u <- x$input + z <- idframe(y,u,Ts = deltat(y),start=start(y)) } else{ - y <- outputData(newdata); u <- inputData(newdata) + z <- newdata } - - - return(ypred) + predict(model,z,nahead) } } @@ -164,4 +164,17 @@ print.idpoly <- function(mod,se=NULL,dig=3){ } } cat("\n") +} + +#' @export +predict.idpoly <- function(x,data,nahead=1){ + y <- outputData(z); u<- inputData(z) + G <- signal::Arma(b=c(rep(0,x$ioDelay),x$B), + a= as.numeric(polynom::polynomial(x$A)* + polynom::polynomial(x$F1))) + + Hden <- as.numeric(polynom::polynomial(x$A)*polynom::polynomial(x$D)) + Hinv <- signal::Arma(b=Hden,a=x$C) + + return(ypred) }
\ No newline at end of file |