M=16
Es=1
Eb = Es/log2(M)
Nsymbols=20
Nbits=log2(M)*Nsymbols
bits <- sample(0:1,Nbits, replace=TRUE)
s <- f16pskmod(bits)
EbNodB=7
No = Eb/(10^(EbNodB/10))
n <- fNo(Nsymbols,No,type="complex")
r <- s+n
bitsr <- f16pskdemod(r)
biterrs<-bits[bitsr!=bits]
b<-factor(bits)
Pberr=length(biterrs)/length(bits)
Run the code above in your browser using DataLab