summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-27 14:51:43 +0530
committerSuraj Yerramilli2016-02-27 14:51:43 +0530
commitece6a9f47a7d73061806f2d7e0788be86aa73688 (patch)
treedaf6bbfbe386a1471c88ed061be81a9a647d380f
parentae603683420f2782407b798a66de700717aad1af (diff)
downloadSysID-R-code-ece6a9f47a7d73061806f2d7e0788be86aa73688.tar.gz
SysID-R-code-ece6a9f47a7d73061806f2d7e0788be86aa73688.tar.bz2
SysID-R-code-ece6a9f47a7d73061806f2d7e0788be86aa73688.zip
updating sim documentation
-rw-r--r--R/sim.R19
-rw-r--r--man/sim.Rd21
2 files changed, 23 insertions, 17 deletions
diff --git a/R/sim.R b/R/sim.R
index f2930b3..35fe386 100644
--- a/R/sim.R
+++ b/R/sim.R
@@ -1,16 +1,19 @@
-#' Simulate dynamic system
+#' Simulate response of dynamic system
#'
-#' Simulate the response of a system given the input
+#' Simulate the response of a system to a given input
#'
#' @param model the linear system to simulate
#' @param input a vector/matrix containing the input
-#' @param innov an optional times series of innovations. If not provided,
-#' innovations are generated using the \code{rnorm} function
-#' @param sigma standard deviation of the innovations (Default= \code{0})
-#' @param seed integer indicating the seed value of the random number generator
+#' @param addNoise logical variable indicating whether to add noise to the
+#' response model. (Default: \code{FALSE})
+#' @param innov an optional times series of innovations. If not supplied (specified
+#' as \code{NULL}), gaussian white noise is generated, with the variance specified in
+#' the model (Property: \code{noiseVar})
+#' @param seed integer indicating the seed value of the random number generator.
+#' Useful for reproducibility purposes.
#'
#' @return
-#' a vector containing the output
+#' a vector containing the simulated output
#'
#' @details
#' The routine is currently built only for SISO systems. Future versions will
@@ -20,7 +23,7 @@
#' # ARX Model
#' u <- rnorm(200,sd=1)
#' model <- idpoly(A=c(1,-1.5,0.7),B=c(0.8,-0.25),ioDelay=1)
-#' y <- sim(model,u,sigma=0.1)
+#' y <- sim(model,u,addNoise=T)
#'
#' @export
sim <- function(model,input,addNoise = F,innov=NULL,seed=NULL) UseMethod("sim")
diff --git a/man/sim.Rd b/man/sim.Rd
index 8bf35a5..a4dfe97 100644
--- a/man/sim.Rd
+++ b/man/sim.Rd
@@ -2,27 +2,30 @@
% Please edit documentation in R/sim.R
\name{sim}
\alias{sim}
-\title{Simulate dynamic system}
+\title{Simulate response of dynamic system}
\usage{
-sim(model, input, innov = NULL, sigma = 0, seed = NULL)
+sim(model, input, addNoise = F, innov = NULL, seed = NULL)
}
\arguments{
\item{model}{the linear system to simulate}
\item{input}{a vector/matrix containing the input}
-\item{innov}{an optional times series of innovations. If not provided,
-innovations are generated using the \code{rnorm} function}
+\item{addNoise}{logical variable indicating whether to add noise to the
+response model. (Default: \code{FALSE})}
-\item{sigma}{standard deviation of the innovations (Default= \code{0})}
+\item{innov}{an optional times series of innovations. If not supplied (specified
+as \code{NULL}), gaussian white noise is generated, with the variance specified in
+the model (Property: \code{noiseVar})}
-\item{seed}{integer indicating the seed value of the random number generator}
+\item{seed}{integer indicating the seed value of the random number generator.
+Useful for reproducibility purposes.}
}
\value{
-a vector containing the output
+a vector containing the simulated output
}
\description{
-Simulate the response of a system given the input
+Simulate the response of a system to a given input
}
\details{
The routine is currently built only for SISO systems. Future versions will
@@ -32,7 +35,7 @@ include support for MIMO systems.
# ARX Model
u <- rnorm(200,sd=1)
model <- idpoly(A=c(1,-1.5,0.7),B=c(0.8,-0.25),ioDelay=1)
-y <- sim(model,u,sigma=0.1)
+y <- sim(model,u,addNoise=T)
}