      subroutine stplot(nmax,y,id,m,epsmax,stp,mfrac,mdt,idt)
      parameter(meps=1000)
      dimension y(nmax),stp(mfrac,mdt),ihist(meps)

      do 10 it=1,mdt
        do 20 ieps=1,meps
 20       ihist(ieps)=0
        print*, it*idt           !c
        do 30 n=it*idt+(m-1)*id+1,nmax
          dis=0                            ! compute distance in $m$ dimensions
          do 40 me=0,m-1
 40         dis=max(dis,abs(y(n-me*id)-y(n-me*id-it*idt)))
          ih=min(int(meps*dis/epsmax)+1,meps)
 30       ihist(ih)=ihist(ih)+1
        do 10 ifrac=1,mfrac
          need=(nmax-it*idt-(m-1)*id)*ifrac/real(mfrac)
          is=0
          do 50 ieps=1,meps
            is=is+ihist(ieps)
 50         if(is.ge.need) goto 1
 1        stp(ifrac,it)=ieps*epsmax/meps
 10     continue
      end
