summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DESCRIPTION2
-rw-r--r--R/idinput.R25
-rw-r--r--man/idinput.Rd36
3 files changed, 61 insertions, 2 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 1a6cc2a..4f20ecc 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -3,7 +3,7 @@ Type: Package
Title: System Identification in R
Version: 1.0
Date: 2015-01-17
-Author: Suraj Yerramilli, Narasimhan Balakrishnan, Arun Tangirala
+Author: Suraj Yerramilli, Ashwin Raman, Narasimhan Balakrishnan, Arun Tangirala
Maintainer: Suraj Yerramilli <surajyerramilli@outlook.com>
Description: The sysid package provides functions for constructing mathematical models of dynamic systems from measured input-output data. The package contains functions for data visualization, data preprocessing, parametric and non-paramteric model estimation, and model predictions and validation.
License: GPL-3
diff --git a/R/idinput.R b/R/idinput.R
index 5251163..3aa1945 100644
--- a/R/idinput.R
+++ b/R/idinput.R
@@ -1,3 +1,26 @@
+#' function to generate input singals (rgs/rbs/prbs/sine)
+#'
+#' \code{idinput} is a function for generating input signals (rgs/rbs/prbs/sine) for identification purposes
+#'
+#' @param n integer length of the input singal to be generated
+#' @param type the type of input signal to be generated.
+#' 'rgs' - generates random gaussian signal
+#' 'rbs' - generates random binary signal
+#' 'prbs' - generates pseudorandom binary signal
+#' 'sine' - generates a signal that is a sum of sinusoids
+#'
+#' Default value is type='rgs'
+#' @param band determines the frequency content of the signal.
+#' For type='rbs'/'sine'/, band = [wlow,whigh]
+#' which specifies the lower and the upper bound of the passband frequencies(expressed as fractions of Nyquist frequency). Default is c(0,1)
+#' For type='prbs', band=[0,B]
+#' where B is such that the singal is constant over 1/B (clock period). Default is c(0,1)
+#' @param levels row vector defining the input level. It is of the form
+#' levels=c(minu, maxu)
+#' For 'rbs','prbs', 'sine', the generated signal always between minu and maxu.
+#' For 'rgs', minu=mean value of signal minus one standard deviation and maxu=mean value of signal plus one standard deviation
+#'
+#' Default value is levels=c(-1,1)
#' @export
idinput<-function(n,type='rgs',band=c(0,1),levels=c(-1,1)){
if(type=="rbs"){
@@ -28,6 +51,6 @@ gen.rbs<-function(n,band,levels){
#if we do not specify else case, it assigns it as NULL
bfilt<-butter(8,band,type = 'pass',plane = 'z')
v1<-filter(bfilt,v)
- v1<-sapply(v1, function(x) {if(x>0) levels[2] else levels[1]})
+ v1<-sapply(v1, function(x) {ifelse(x>0 , levels[2] , levels[1]) })
return(v1)
} \ No newline at end of file
diff --git a/man/idinput.Rd b/man/idinput.Rd
new file mode 100644
index 0000000..3f64f4b
--- /dev/null
+++ b/man/idinput.Rd
@@ -0,0 +1,36 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/idinput.R
+\name{idinput}
+\alias{idinput}
+\title{function to generate input singals (rgs/rbs/prbs/sine)}
+\usage{
+idinput(n, type = "rgs", band = c(0, 1), levels = c(-1, 1))
+}
+\arguments{
+\item{n}{integer length of the input singal to be generated}
+
+\item{type}{the type of input signal to be generated.
+'rgs' - generates random gaussian signal
+'rbs' - generates random binary signal
+'prbs' - generates pseudorandom binary signal
+'sine' - generates a signal that is a sum of sinusoids
+
+Default value is type='rgs'}
+
+\item{band}{determines the frequency content of the signal.
+For type='rbs'/'sine'/, band = [wlow,whigh]
+which specifies the lower and the upper bound of the passband frequencies(expressed as fractions of Nyquist frequency). Default is c(0,1)
+For type='prbs', band=[0,B]
+where B is such that the singal is constant over 1/B (clock period). Default is c(0,1)}
+
+\item{levels}{row vector defining the input level. It is of the form
+levels=c(minu, maxu)
+For 'rbs','prbs', 'sine', the generated signal always between minu and maxu.
+For 'rgs', minu=mean value of signal minus one standard deviation and maxu=mean value of signal plus one standard deviation
+
+Default value is levels=c(-1,1)}
+}
+\description{
+\code{idinput} is a function for generating input signals (rgs/rbs/prbs/sine) for identification purposes
+}
+