subroutine timeavp(seq,av,sdv,net,fave,smin,smax) c c time average seq over the last fave fraction of the time c series of length net. c sdv is the standard deviation. c implicit none include 'itg.par' include 'itg.cmn' c include 'post.cmn' real seq(fno*nez),av,sdv,fave,smin,smax,deltm,time1,time2 integer net integer i_first,i_last,i c c if (net.le.2) return if (fave.gt.1.) fave=1. i_first=1+(1.-fave)*(net-1) i_last=net c i_first=i_first+1 time1=timo(i_first) time2=timo(i_last) deltm=time2-time1 c av=0. av=0.5*seq(i_first)*(timo(i_first)-timo(i_first-1)) do i=i_first+1,i_last-1 av=av+seq(i)*(timo(i)-timo(i-1)) enddo av=av+0.5*seq(i_last)*(timo(i_last)-timo(i_last-1)) av=av/deltm c sdv=0. sdv=0.5*(seq(i_first)-av)*(seq(i_first)-av) * *(timo(i_first)-timo(i_first-1)) do i=i_first+1,i_last-1 sdv=sdv+(seq(i)-av)*(seq(i)-av)*(timo(i)-timo(i-1)) enddo sdv=sdv+0.5*(seq(i_last)-av)*(seq(i_last)-av) * *(timo(i_last)-timo(i_last-1)) sdv=sdv/deltm if(sdv.gt.1.e-10) sdv=sqrt(sdv) c smin=seq(i_first) smax=seq(i_first) do i=i_first+1,i_last if (seq(i).gt.smax) smax=seq(i) if (seq(i).lt.smin) smin=seq(i) enddo return end