diff options
author | ashwinrcs | 2015-10-09 11:37:08 +0530 |
---|---|---|
committer | ashwinrcs | 2015-10-09 11:37:08 +0530 |
commit | 69813446dfe77003c88773da6bc397a1658229e1 (patch) | |
tree | c1cd21b62841d21eab6e59db7c3fe4c2cdc18337 /R | |
parent | bd9241669649b2a59c89fad97c5bb612a05f5618 (diff) | |
download | SysID-R-code-69813446dfe77003c88773da6bc397a1658229e1.tar.gz SysID-R-code-69813446dfe77003c88773da6bc397a1658229e1.tar.bz2 SysID-R-code-69813446dfe77003c88773da6bc397a1658229e1.zip |
Adding rbs/rgs signal generation code file to the repository
Diffstat (limited to 'R')
-rw-r--r-- | R/myCode/idinput.R | 9 | ||||
-rw-r--r-- | R/myCode/plots/rbsPlot.png | bin | 0 -> 68454 bytes | |||
-rw-r--r-- | R/myCode/plots/rgsPlot.png | bin | 0 -> 38297 bytes | |||
-rw-r--r-- | R/myCode/rbs1.R | 11 | ||||
-rw-r--r-- | R/myCode/rgs1.R | 10 | ||||
-rw-r--r-- | R/myCode/test.R | 0 | ||||
-rw-r--r-- | R/myCode/testCases.docx | bin | 0 -> 122183 bytes |
7 files changed, 30 insertions, 0 deletions
diff --git a/R/myCode/idinput.R b/R/myCode/idinput.R new file mode 100644 index 0000000..05472e1 --- /dev/null +++ b/R/myCode/idinput.R @@ -0,0 +1,9 @@ +idinput<-function(n,type='rgs',band=c(0,1),levels=c(-1,1)){ + if(type=="rbs"){ + v1<-gen.rbs(n,band,levels) + } + else if(type=="rgs"){ + v1<-gen.rgs(n,band,levels) + } + return(v1) +}
\ No newline at end of file diff --git a/R/myCode/plots/rbsPlot.png b/R/myCode/plots/rbsPlot.png Binary files differnew file mode 100644 index 0000000..f696501 --- /dev/null +++ b/R/myCode/plots/rbsPlot.png diff --git a/R/myCode/plots/rgsPlot.png b/R/myCode/plots/rgsPlot.png Binary files differnew file mode 100644 index 0000000..8fb1c24 --- /dev/null +++ b/R/myCode/plots/rgsPlot.png diff --git a/R/myCode/rbs1.R b/R/myCode/rbs1.R new file mode 100644 index 0000000..6d6d3a5 --- /dev/null +++ b/R/myCode/rbs1.R @@ -0,0 +1,11 @@ +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) + v1<-sapply(v1, function(x) {if(x>0) levels[2] else levels[1]}) + return(v1) +}
\ No newline at end of file diff --git a/R/myCode/rgs1.R b/R/myCode/rgs1.R new file mode 100644 index 0000000..cf4855b --- /dev/null +++ b/R/myCode/rgs1.R @@ -0,0 +1,10 @@ +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) + return(v1) +}
\ No newline at end of file diff --git a/R/myCode/test.R b/R/myCode/test.R new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/R/myCode/test.R diff --git a/R/myCode/testCases.docx b/R/myCode/testCases.docx Binary files differnew file mode 100644 index 0000000..1324173 --- /dev/null +++ b/R/myCode/testCases.docx |