Eb=1
Nbits=10
bits <- sample(0:1,Nbits, replace=TRUE)
s <- fbpskmod(bits)
EbNodB=8
No = Eb/(10^(EbNodB/10))
n <- fNo(Nbits,No)
r <- s+n
bitsr <- fbpskdemod(r)
biterrs<-bits[bitsr!=bits]
Pberr=length(biterrs)/length(bits)
Run the code above in your browser using DataLab