From 884854223c3df5b3855870d0bf1afb9ceb880418 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 27 Jul 2020 14:02:33 -0400 Subject: [PATCH] Add computation of an average spectrum of unmodulated FST4 signals after decoding. --- lib/fst4_decode.f90 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index 54761b38b..83a6f8295 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -821,6 +821,7 @@ contains complex, allocatable :: cwave(:) !Reconstructed complex signal complex, allocatable :: g(:) !Channel gain, g(t) in QEX paper real,allocatable :: ss(:) !Computed power spectrum of g(t) + real,allocatable,save :: ssavg(:) !Computed power spectrum of g(t) integer itone(160) !Tones for this message integer*2 iwave(nmax) !Raw Rx data integer hmod !Modulation index @@ -907,6 +908,22 @@ contains 1010 format(f12.6,f12.6) enddo + if(nsps.eq.720) then + ia=101.0/df + if(ncall.eq.1) then + allocate(ssavg(-ia:ia)) + ssavg=0. + endif + rewind 53 + do i=-ia,ia !Find smax in +/- 1 Hz around 0. + j=i + if(j.lt.0) j=i+nfft + ssavg(i)=ssavg(i) + real(g(j))**2 + aimag(g(j))**2 + write(53,1020) i*df,ssavg(i) +1020 format(f12.6,e12.3) + enddo + endif + return end subroutine write_ref