WSJT-X/lib/superfox/sfox_clo.f90

38 lines
827 B
Fortran
Raw Normal View History

2024-02-10 19:51:36 -05:00
subroutine sfox_clo(fsample,syncwidth,clo)
! Generate complex LO for the SuperFox sync signal
use sfox_mod
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)
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
c(i)=w
enddo
return
end subroutine sweep