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