summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-27 14:04:26 +0530
committerSuraj Yerramilli2016-02-27 14:04:26 +0530
commit9a33548afc4fac3275bdbcffc87f8ba3a57c17fb (patch)
tree80753face97359e56aeeac8dca486f2ffb286bb9 /R
parentd04167e1355a9981dac447d82e44c0bb6f2f4e1e (diff)
downloadSysID-R-code-9a33548afc4fac3275bdbcffc87f8ba3a57c17fb.tar.gz
SysID-R-code-9a33548afc4fac3275bdbcffc87f8ba3a57c17fb.tar.bz2
SysID-R-code-9a33548afc4fac3275bdbcffc87f8ba3a57c17fb.zip
added option to specify noise variance
Diffstat (limited to 'R')
-rw-r--r--R/poly.R18
1 files changed, 12 insertions, 6 deletions
diff --git a/R/poly.R b/R/poly.R
index 9ab4fab..77525e3 100644
--- a/R/poly.R
+++ b/R/poly.R
@@ -2,13 +2,15 @@
#'
#' Creates a polynomial model with identifiable coefficients
#'
-#' @param A Autoregressive coefficients
-#' @param B,F1 Coefficients of the numerator and denominator respectively
+#' @param A autoregressive coefficients
+#' @param B,F1 coefficients of the numerator and denominator respectively
#' of the deterministic model between the input and output
-#' @param C,D Coefficients of the numerator and denominator respectively
+#' @param C,D coefficients of the numerator and denominator respectively
#' of the stochastic model
#' @param ioDelay the delay in the input-output channel
#' @param Ts sampling interval
+#' @param noiseVar variance of the white noise source (Default=\code{1})
+#' @param unit time unit (Default=\code{"seconds"})
#'
#' @details
#' Discrete-time polynomials are of the form
@@ -19,7 +21,8 @@
#'
#' @examples
#' # define output-error model
-#' mod_oe <- idpoly(B=c(0.6,-0.2),F1=c(1,-0.5),ioDelay = 2,Ts=0.1)
+#' mod_oe <- idpoly(B=c(0.6,-0.2),F1=c(1,-0.5),ioDelay = 2,Ts=0.1,
+#' noiseVar = 0.1)
#'
#' # define box-jenkins model
#' B <- c(0.6,-0.2)
@@ -29,8 +32,11 @@
#' mod_bj <- idpoly(1,B,C,D,F1,ioDelay=1)
#'
#' @export
-idpoly <- function(A=1,B=1,C=1,D=1,F1=1,ioDelay=0,Ts=1){
- out <- list(A= A,B=B,C=C,D=D,F1=F1,ioDelay = ioDelay,Ts=Ts)
+idpoly <- function(A=1,B=1,C=1,D=1,F1=1,ioDelay=0,Ts=1,
+ noiseVar=1,unit = c("seconds","minutes",
+ "hours","days")[1]){
+ out <- list(A= A,B=B,C=C,D=D,F1=F1,ioDelay = ioDelay,Ts=Ts,
+ noiseVar=noiseVar,unit=unit)
out$type <- typecheck(out)
class(out) <- "idpoly"
return(out)