WSJT-X/lib/flat1.f90
Joe Taylor 86591544f0 Merge changes from branches/wsjtx_w back into branches/wsjtx.
Note to developers: Not sure about the makefiles...


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3835 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2014-03-05 18:20:40 +00:00

28 lines
454 B
Fortran

subroutine flat1(savg,iz,nsmo,syellow)
real savg(iz)
real syellow(iz)
real x(8192)
ia=nsmo/2 + 1
ib=iz - nsmo/2 - 1
nstep=20
nh=nstep/2
do i=ia,ib,nstep
call pctile(savg(i-nsmo/2),nsmo,50,x(i))
x(i-nh:i+nh-1)=x(i)
enddo
do i=1,ia-1
x(i)=x(ia)
enddo
do i=ib+1,iz
x(i)=x(ib)
enddo
x0=0.001*maxval(x(1:iz))
syellow(1:iz)=savg(1:iz)/(x(1:iz)+x0)
return
end subroutine flat1