Do polyfit to fil vector in refspectrum.f90 and write the coeffs to the first line of refspec.dat.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7576 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2017-02-22 20:43:40 +00:00
parent 5d9ac3966b
commit d1ad018b1a

View File

@ -16,6 +16,7 @@ subroutine refspectrum(id2,bclear,brefspec,buseref,fname)
real*4 w(0:NFFT-1) !Window function
real*4 s(0:NH) !Average spectrum
real*4 fil(0:NH)
real*8 xfit(1500),yfit(1500),sigmay(1500),a(5),chisqr !Polyfit arrays
logical first,firstuse
complex cx(0:NH) !Complex frequency-domain work array
character*(*) fname
@ -97,7 +98,20 @@ subroutine refspectrum(id2,bclear,brefspec,buseref,fname)
if(s(i).gt.0.0) filter(i)=20.0*log10(fil(i))
enddo
il=nint(400.0/df)
ih=nint(2600.0/df)
nfit=ih-il+1
mode=0
nterms=5
do i=1,nfit
xfit(i)=((i+il-1)*df-1500.0)/1000.0
yfit(i)=fil(i+il-1)
sigmay(i)=1.0
enddo
call polyfit(xfit,yfit,sigmay,nfit,nterms,mode,a,chisqr)
open(16,file=fname,status='unknown')
write(16,'(5f10.4)') a
do i=1,NH
freq=i*df
ref(i)=db(s(i)/avemid)