mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-09-08 22:36:40 -04:00
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2659 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
26 lines
400 B
Fortran
26 lines
400 B
Fortran
subroutine pctile(x,npts,npct,xmedian)
|
|
|
|
real x(npts)
|
|
integer hist(0:1000)
|
|
|
|
ave=sum(x)/npts
|
|
hist=0
|
|
do i=1,npts
|
|
j=nint(100.0*x(i)/ave)
|
|
if(j.lt.0) j=0
|
|
if(j.gt.1000) j=1000
|
|
hist(j)=hist(j)+1
|
|
enddo
|
|
|
|
nsum=0
|
|
ntest=nint(npts*float(npct)/100.0)
|
|
do j=0,1000
|
|
nsum=nsum+hist(j)
|
|
if(nsum.ge.ntest) exit
|
|
enddo
|
|
|
|
xmedian=j*ave/100.0
|
|
|
|
return
|
|
end subroutine pctile
|