summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/sim.R27
1 files changed, 25 insertions, 2 deletions
diff --git a/R/sim.R b/R/sim.R
index 59aa49e..3892958 100644
--- a/R/sim.R
+++ b/R/sim.R
@@ -1,11 +1,34 @@
#' @export
-sim <- function(model,input) UseMethod("sim")
+sim <- function(model,input,sigma=0) UseMethod("sim")
#' @export
-sim.default <- function(model,input){
+sim.default <- function(model,input,sigma=0){
print("The sim method is not developed for the current class of the object")
}
+#' Simulate from an ARX Model
+#'
+#' Simulate the response of an ARX system, given the input
+#'
+#' @param model an object of class \code{arx} containing the coefficients
+#' @param input a vector/matrix containing the input
+#' @param sigma standard deviation of the innovations (Default= \code{0})
+#'
+#' @return
+#' a vector containing the output
+#'
+#' @details
+#' The routine is currently built only for SISO systems. Future Versions will
+#' include support for MIMO systems
+#'
+#' @seealso
+#' \code{\link{arx}} for defining ARX models
+#'
+#' @examples
+#' u <- rnorm(100,1)
+#' model <- arx(A=c(1,-1.5,0.7),B=c(0.8,-0.25))
+#' y <- sim(model,u,sigma=3)
+#'
#' @export
sim.arx <- function(model,input,sigma=0){
na <- length(model$A) - 1; nk <- model$ioDelay;