Fix the calculation of symbol error probability.

This commit is contained in:
Steve Franke 2018-06-16 09:03:32 -05:00
parent 6846964170
commit c18338b83b

View File

@ -13,10 +13,9 @@ integer*1, allocatable :: codeword(:), decoded(:), message(:)
integer*1, target:: i1Msg8BitBytes(12)
integer*1 apmask(N),cw(N)
integer*1 msgbits(90)
integer*2 checksum
integer*2 ncrc13
integer*4 i4Msg6BitWords(13)
integer nerrtot(0:N),nerrdec(0:N),nmpcbad(0:K),nbadwt(0:N)
logical checksumok
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
real, allocatable :: yy(:), llr(:)
@ -63,9 +62,9 @@ msg="G4WJS K1JT FN20"
tmpchar(73:77)="00000" !i5bit
read(tmpchar,'(10b8)') i1Msg8BitBytes(1:10)
i1Msg8BitBytes(10:12)=0
checksum = crc13 (c_loc (i1Msg8BitBytes), 12)
ncrc13 = crc13 (c_loc (i1Msg8BitBytes), 12)
write(tmpchar(78:90),'(b13)') checksum
write(tmpchar(78:90),'(b13)') ncrc13
read(tmpchar,'(90i1)') msgbits(1:90)
write(*,*) 'msgbits'
@ -75,13 +74,14 @@ msg="G4WJS K1JT FN20"
call init_random_seed()
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadcrc sigma"
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadcrc sigma psymerr"
do idb = 14,-6,-1
db=idb/2.0-1.0
sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
ngood=0
nue=0
nbadcrc=0
nsumerr=0
do itrial=1, ntrials
rxavgd=0d0
@ -136,11 +136,12 @@ do idb = 14,-6,-1
nbadwt(nhw)=nbadwt(nhw)+1 ! store the weight of the error vector
endif
endif
nsumerr=nsumerr+nerr
enddo
snr2500=db-2.5
pberr=real(nerr)/real(ntrials*N)
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2,8x,e10.3)") db,snr2500,ngood,nue,nbadcrc,ss,pberr
pberr=real(nsumerr)/real(ntrials*N)
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,7x,f5.2,3x,e10.3)") db,snr2500,ngood,nue,nbadcrc,ss,pberr
enddo