Move the sweep generator into a separate routine.

This commit is contained in:
Joe Taylor 2024-02-21 13:44:20 -05:00
parent d44d00453f
commit 254a15b4f6
2 changed files with 22 additions and 12 deletions

View File

@ -3,24 +3,35 @@ subroutine sfox_clo(fsample,syncwidth,clo)
! Generate complex LO for the SuperFox sync signal
use sfox_mod
complex clo(NMAX) !Complex Local Oscillator
complex clo(NSYNC) !Complex Local Oscillator
complex w
w=1.0
call sweep(1500.0,syncwidth,fsample,w,clo,nsync)
clo=conjg(clo)
return
end subroutine sfox_clo
subroutine sweep(f0,syncwidth,fsample,w,c,iz)
complex c(iz)
complex w,wstep
twopi=8.0*atan(1.0)
tsync=NS*NSPS/fsample
w=1.0
a0=1500.0+ syncwidth/2.0 !Frequency at midpoint of LO waveform
a2=2.0*syncwidth/tsync !Frequency drift rate
x0=0.5*(nsync+1)
s=2.0/nsync
do i=1,nsync
if(i.eq.nsync/2+1) a2=-a2 !Reverse sign of drift at midpoint
ttot=iz/fsample
a0=f0 + syncwidth/2.0 !Frequency at midpoint of LO waveform
a2=2.0*syncwidth/ttot !Frequency drift rate
x0=0.5*(iz+1)
s=2.0/iz
do i=1,iz
if(i.eq.iz/2+1) a2=-a2 !Reverse sign of drift at midpoint
x=s*(i-x0)
dphi=(a0 + x*a2)*(twopi/fsample)
wstep=cmplx(cos(dphi),sin(dphi))
w=w*wstep
clo(i)=conjg(w)
c(i)=w
enddo
return
end subroutine sfox_clo
end subroutine sweep

View File

@ -215,7 +215,6 @@ program sfoxtest
ntot=ntot+nharderr
nworst=max(nworst,nharderr)
! call rs_decode_sf(rxdat,iera,nera,nfixed) !Call the BM decoder
ntrials=1000
call timer('ftrsd3 ',0)
call ftrsd3(s3,chansym0,rxdat,rxprob,rxdat2,rxprob2,ntrials, &