2024-02-26 12:32:25 -05:00
|
|
|
subroutine sfox_gen(idat,f0,fsample,isync,itone,cdat)
|
2024-01-31 12:58:27 -05:00
|
|
|
|
2024-02-08 10:45:43 -05:00
|
|
|
use sfox_mod
|
2024-01-31 12:58:27 -05:00
|
|
|
complex cdat(NMAX) !Generated complex waveform
|
|
|
|
complex w,wstep
|
2024-02-15 08:53:44 -05:00
|
|
|
integer idat(NN)
|
2024-02-25 10:10:51 -05:00
|
|
|
integer isync(44)
|
|
|
|
integer itone(171)
|
2024-01-31 12:58:27 -05:00
|
|
|
|
|
|
|
twopi=8.0*atan(1.0)
|
2024-02-25 10:10:51 -05:00
|
|
|
|
|
|
|
! Create the itone sequence: data symbols and interspersed sync symbols
|
|
|
|
j=1
|
|
|
|
k=0
|
|
|
|
do i=1,NDS
|
2024-02-25 20:31:21 -05:00
|
|
|
if(j.le.NS .and. i.eq.isync(j)) then
|
|
|
|
if(j.lt.NS) j=j+1 !Index for next sync symbol
|
2024-02-25 10:10:51 -05:00
|
|
|
itone(i)=0 !Insert sync symbol at tone 0
|
|
|
|
else
|
|
|
|
k=k+1
|
|
|
|
itone(i)=idat(k) + 1 !Symbol value 0 is transmitted at tone 1, etc.
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
2024-01-31 12:58:27 -05:00
|
|
|
df=fsample/NSPS
|
2024-02-10 13:35:06 -05:00
|
|
|
w=1.0
|
2024-01-31 12:58:27 -05:00
|
|
|
j=0
|
2024-02-10 13:35:06 -05:00
|
|
|
i0=NQ/2
|
2024-02-25 10:10:51 -05:00
|
|
|
! Generate the waveform
|
2024-02-26 12:32:25 -05:00
|
|
|
do k=1,NDS !Loop over all symbols
|
2024-02-25 10:10:51 -05:00
|
|
|
dphi=(f0 + (itone(k)-i0)*df)*(twopi/fsample)
|
2024-01-31 12:58:27 -05:00
|
|
|
wstep=cmplx(cos(dphi),sin(dphi))
|
2024-02-26 12:32:25 -05:00
|
|
|
do i=1,NSPS !NSPS samples per symbol
|
2024-01-31 12:58:27 -05:00
|
|
|
j=j+1
|
|
|
|
w=w*wstep
|
|
|
|
cdat(j)=w
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
return
|
2024-02-10 19:51:36 -05:00
|
|
|
end subroutine sfox_gen
|