summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-06-06 00:24:38 +0530
committerSuraj Yerramilli2015-06-06 00:24:38 +0530
commitcb696cfcc830e10b6518cf1d768884e967bc84b3 (patch)
tree6a56f6cb166b2b4431a2491fe435d2d580c11d07
parenta54aef7be7f1db6aca3588719832751dd4ce00d7 (diff)
downloadSysID-R-code-cb696cfcc830e10b6518cf1d768884e967bc84b3.tar.gz
SysID-R-code-cb696cfcc830e10b6518cf1d768884e967bc84b3.tar.bz2
SysID-R-code-cb696cfcc830e10b6518cf1d768884e967bc84b3.zip
Added variance info
-rw-r--r--R/sim.R4
1 files changed, 2 insertions, 2 deletions
diff --git a/R/sim.R b/R/sim.R
index 5224b61..1213ecd 100644
--- a/R/sim.R
+++ b/R/sim.R
@@ -2,7 +2,7 @@
sim <- function(x) useMethod("sim")
#' @export
-sim.arx <- function(model,input){
+sim.arx <- function(model,input,sigma=0){
na <- length(model$A) - 1; nk <- model$ioDelay;
nb <- length(model$B) - nk
n <- max(na,nb+nk)
@@ -14,7 +14,7 @@ sim.arx <- function(model,input){
for(i in n+1:length(input)){
reg <- cbind(-y[i-1:na,],u[i-nk:nb1,])
- y[i] <- reg%*%coef
+ y[i] <- reg%*%coef + rnorm(1,sd = sigma)
}
return(y[n+1:length(input),,drop=F])
} \ No newline at end of file