summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-26 14:11:15 +0530
committerSuraj Yerramilli2016-02-26 14:11:15 +0530
commitf9f41b2f8b413bab042c87046c65925786bceedf (patch)
treea5a6d6a82c9e369d03000fd2d35e0b540d0097d7
parent1e140a3650e11aa53b7c90210d1367b7c229f7a6 (diff)
downloadSysID-R-code-f9f41b2f8b413bab042c87046c65925786bceedf.tar.gz
SysID-R-code-f9f41b2f8b413bab042c87046c65925786bceedf.tar.bz2
SysID-R-code-f9f41b2f8b413bab042c87046c65925786bceedf.zip
minor corrections in the sim routine
-rw-r--r--R/sim.R8
-rw-r--r--man/sim.Rd2
-rw-r--r--man/sim.idpoly.Rd39
3 files changed, 4 insertions, 45 deletions
diff --git a/R/sim.R b/R/sim.R
index 8811210..dfceb81 100644
--- a/R/sim.R
+++ b/R/sim.R
@@ -13,7 +13,7 @@
#' a vector containing the output
#'
#' @details
-#' The routine is currently built only for SISO systems. Future Versions will
+#' The routine is currently built only for SISO systems. Future versions will
#' include support for MIMO systems.
#'
#' @examples
@@ -30,9 +30,10 @@ sim.default <- function(model,input,sigma=0,seed=NULL){
print("The sim method is not developed for the current class of the object")
}
-#' @import polynom
+#' @import signal polynom
#' @export
sim.idpoly <- function(model,input,innov=NULL,sigma=0,seed=NULL){
+ n <- length(input)[1]
if(!is.null(innov)){
ek <- innov
} else{
@@ -43,9 +44,6 @@ sim.idpoly <- function(model,input,innov=NULL,sigma=0,seed=NULL){
if(model$type=="arx"){
sim_arx(model,input,ek)
} else{
- require(signal);require(polynom)
-
- n <- length(input)[1]
den1 <- as.numeric(polynomial(model$A)*polynomial(model$D))
filt1 <- Arma(b=model$C,a=den1)
diff --git a/man/sim.Rd b/man/sim.Rd
index 0f9eeef..8bf35a5 100644
--- a/man/sim.Rd
+++ b/man/sim.Rd
@@ -25,7 +25,7 @@ a vector containing the output
Simulate the response of a system given the input
}
\details{
-The routine is currently built only for SISO systems. Future Versions will
+The routine is currently built only for SISO systems. Future versions will
include support for MIMO systems.
}
\examples{
diff --git a/man/sim.idpoly.Rd b/man/sim.idpoly.Rd
deleted file mode 100644
index eae901e..0000000
--- a/man/sim.idpoly.Rd
+++ /dev/null
@@ -1,39 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/sim.R
-\name{sim.idpoly}
-\alias{sim.idpoly}
-\title{Simulate from a Polynomial Model}
-\usage{
-\method{sim}{idpoly}(model, input, sigma = 0, seed = NULL)
-}
-\arguments{
-\item{model}{an object of class \code{idpoly} containing the coefficients}
-
-\item{input}{a vector/matrix containing the input}
-
-\item{sigma}{standard deviation of the innovations (Default= \code{0})}
-
-\item{seed}{integer indicating the seed value of the random number generator}
-}
-\value{
-a vector containing the output
-}
-\description{
-Simulate the response of a system governed by a polynomial model
-, given the input
-}
-\details{
-The routine is currently built only for SISO systems. Future Versions will
-include support for MIMO systems
-}
-\examples{
-# 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)
-
-}
-\seealso{
-\code{\link{idpoly}} for defining polynomial models
-}
-