diff options
author | Suraj Yerramilli | 2016-01-02 17:44:27 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-01-02 17:44:27 +0530 |
commit | 74e4db50e71c1dc588c78e7589d9da7958a9be7a (patch) | |
tree | dca84dc71128c8c2babf7147ddc71999bd7bbb8d /R | |
parent | ab705c117a58fd29362a0487215b7e1b1be729a6 (diff) | |
download | SysID-R-code-74e4db50e71c1dc588c78e7589d9da7958a9be7a.tar.gz SysID-R-code-74e4db50e71c1dc588c78e7589d9da7958a9be7a.tar.bz2 SysID-R-code-74e4db50e71c1dc588c78e7589d9da7958a9be7a.zip |
removed redundant require statements
Diffstat (limited to 'R')
-rw-r--r-- | R/idinput.R | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/R/idinput.R b/R/idinput.R index 3aa1945..f3e7141 100644 --- a/R/idinput.R +++ b/R/idinput.R @@ -21,6 +21,7 @@ #' 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"){ @@ -33,24 +34,22 @@ idinput<-function(n,type='rgs',band=c(0,1),levels=c(-1,1)){ } gen.rgs<-function(n,band,levels){ - require(signal) mu<-(levels[1]+levels[2])/2 sigma<-(levels[2]-levels[1])/2 v<-rnorm(n,mu,sigma) v<-sapply(v, function(x) {if(x==0) rnorm(1) else x}) - gfilt<-butter(8,band,type ='pass',plane ='z') - v1<-filter(gfilt,v) + gfilt<-signal::butter(8,band,type ='pass',plane ='z') + v1<-signal::filter(gfilt,v) return(v1) } gen.rbs<-function(n,band,levels){ - require(signal) v<-rnorm(n) v<-sapply(v, function(x) {if(x==0) rnorm(1) else x}, simplify = 'vector') #if we do not specify else case, it assigns it as NULL - bfilt<-butter(8,band,type = 'pass',plane = 'z') - v1<-filter(bfilt,v) + bfilt<-signal::butter(8,band,type = 'pass',plane = 'z') + v1<-signal::filter(bfilt,v) v1<-sapply(v1, function(x) {ifelse(x>0 , levels[2] , levels[1]) }) return(v1) }
\ No newline at end of file |