diff options
Diffstat (limited to 'R/rbs1.R')
-rw-r--r-- | R/rbs1.R | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/R/rbs1.R b/R/rbs1.R new file mode 100644 index 0000000..033f6a3 --- /dev/null +++ b/R/rbs1.R @@ -0,0 +1,22 @@ +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 |