diff options
author | ashwinrcs | 2015-10-12 16:40:29 +0530 |
---|---|---|
committer | ashwinrcs | 2015-10-12 16:40:29 +0530 |
commit | 658afa181832442a9198636a88dbd707c4538d51 (patch) | |
tree | e4ce4242e09d20987a083325fbbc012b4926d2b4 /R | |
parent | f76f456d4e81b043c004fe1a052f1e3c2a89dac7 (diff) | |
download | SysID-R-code-658afa181832442a9198636a88dbd707c4538d51.tar.gz SysID-R-code-658afa181832442a9198636a88dbd707c4538d51.tar.bz2 SysID-R-code-658afa181832442a9198636a88dbd707c4538d51.zip |
updated
Diffstat (limited to 'R')
-rw-r--r-- | R/rbs.R | 34 | ||||
-rw-r--r-- | R/rbs1.R | 22 | ||||
-rw-r--r-- | R/rgs.R | 24 |
3 files changed, 0 insertions, 80 deletions
diff --git a/R/rbs.R b/R/rbs.R deleted file mode 100644 index 98fa785..0000000 --- a/R/rbs.R +++ /dev/null @@ -1,34 +0,0 @@ -#' @export -idin.rbs <- function(n,band,levels){ - # Function to generate a random binary - # signal of given frequency band and levels - require(signal) - uk1 = rnorm(n,mean = 0,sd = 1) - uk = rep(0,n) - for(i in 1:n){ - #Checking for zeros - - if(uk1[i] == 0){ - uk1[i] <- rnorm(1,mean = 0,sd = 1) - } - } - # Getting the filter coefficients - bfilt <- butter(8,c(band[1],band[2]),type = "pass",plane = "z") - - # Filtering the signal - ukf <- filter(bfilt,uk1) - - # Getting the binary signal - for(i in 1:n){ - if(ukf[i] < 0){ - uk[i] = levels[1] - } - } - for(i in 1:n){ - if(ukf[i] > 0){ - uk[i] = levels[2] - } - } - return(uk) -} - diff --git a/R/rbs1.R b/R/rbs1.R deleted file mode 100644 index 033f6a3..0000000 --- a/R/rbs1.R +++ /dev/null @@ -1,22 +0,0 @@ -gen.rbs<-function(n,band,type){ - require(signal) - v<-rnorm(n) - for(i in 1:n){ - if (v[i]==0){ - - v[i]=rnorm(1) - } - } - a<-butter(8,band,type = type,plane = 'z') - v1=filter(a,v) - for(i in 1:n){ - - if(v1[i]>0){ - v1[i]=1 - } - if(v1[i]<0){ - v1[i]=-1 - } - } - return(v1) -}
\ No newline at end of file diff --git a/R/rgs.R b/R/rgs.R deleted file mode 100644 index ee1eca3..0000000 --- a/R/rgs.R +++ /dev/null @@ -1,24 +0,0 @@ -#' @export -idin.rgs <- function(n,band,var){ - # Function to generate a random Gaussian - # signal of given frequency band and variance - require(signal) - uk1 <- rnorm(n,mean = 0,sd = 1) - - for(i in 1:n){ - #Checking for zeros - - if(uk1[i] == 0){ - uk1[i] <- rnorm(1,mean = 0,sd = 1) - } - } - # Getting the filter coefficients - bfilt <- butter(8,c(band[1],band[2]),type = "pass",plane = "z") - - # Filtering the signal - ukf <- filter(bfilt,uk1) - - # Adjusting for required variance - uk <- sqrt(var)*ukf - return(uk) -}
\ No newline at end of file |