From 87b97039b69aff12517aabca4200133fb053da16 Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Thu, 25 Oct 2018 16:39:17 -0500 Subject: [PATCH] Remove a small bias in Watterson channel simulator channel amplitude. --- lib/fsk4hf/wsprsimf.f90 | 2 +- lib/ft8/ft8sim.f90 | 2 +- lib/ft8/watterson.f90 | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/fsk4hf/wsprsimf.f90 b/lib/fsk4hf/wsprsimf.f90 index c6c71fe6e..d6ee25d44 100644 --- a/lib/fsk4hf/wsprsimf.f90 +++ b/lib/fsk4hf/wsprsimf.f90 @@ -77,7 +77,7 @@ program wsprsim c=c0 if(nwav.eq.0) then if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then - call watterson(c,NMAX/NDOWN,fs,delay,fspread) + call watterson(c,NMAX/NDOWN,NN*NSPS,fs,delay,fspread) endif c=c*sig if(snrdb.lt.90) then diff --git a/lib/ft8/ft8sim.f90 b/lib/ft8/ft8sim.f90 index 84884c5e2..80f98fcfb 100644 --- a/lib/ft8/ft8sim.f90 +++ b/lib/ft8/ft8sim.f90 @@ -102,7 +102,7 @@ program ft8sim phi=mod(phi+dphi,twopi) enddo enddo - if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c0,NMAX,fs,delay,fspread) + if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c0,NMAX,NWAVE,fs,delay,fspread) c=sig*c0 ib=k diff --git a/lib/ft8/watterson.f90 b/lib/ft8/watterson.f90 index d047a26eb..a1131d7b1 100644 --- a/lib/ft8/watterson.f90 +++ b/lib/ft8/watterson.f90 @@ -1,5 +1,8 @@ -subroutine watterson(c,npts,fs,delay,fspread) - +subroutine watterson(c,npts,nsig,fs,delay,fspread) +! +! npts is the total length of the simulated data vector +! nsig is the number of points that are occupied by signal +! complex c(0:npts-1) complex c2(0:npts-1) complex cs1(0:npts-1) @@ -55,7 +58,7 @@ subroutine watterson(c,npts,fs,delay,fspread) ! write(61,3001) i/12000.0,c(i) !3001 format(3f12.6) enddo - rms=sqrt(sq/npts) + rms=sqrt(sq/nsig) c=c/rms return