WSJT-X/lib/averms.f90
Joe Taylor 31f8733e7f MOving toward use of sync64(). Not yet there!
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6939 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2016-07-22 19:52:20 +00:00

21 lines
303 B
Fortran

subroutine averms(x,n,nskip,ave,rms)
real x(n)
integer ipk(1)
ns=0
s=0.
sq=0.
ipk=maxloc(x)
do i=1,n
if(abs(i-ipk(1)).gt.nskip) then
s=s + x(i)
sq=sq + x(i)**2
ns=ns+1
endif
enddo
ave=s/ns
rms=sqrt(sq/ns - ave*ave)
return
end subroutine averms