diff options
| author | hibby <d@vehibberd.com> | 2018-02-16 15:17:14 +0000 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2018-02-16 15:17:14 +0000 |
| commit | 37f727ac0746fd85504aa46c1f023c09b3eff33a (patch) | |
| tree | c8a7ce04545040a8f161ba279528730bd9a3e6ab /lib/sh65snr.f90 | |
| parent | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (diff) | |
New upstream version 1.8.0+repackupstream/1.8.0+repack
Diffstat (limited to 'lib/sh65snr.f90')
| -rw-r--r-- | lib/sh65snr.f90 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/sh65snr.f90 b/lib/sh65snr.f90 new file mode 100644 index 00000000..3d449010 --- /dev/null +++ b/lib/sh65snr.f90 @@ -0,0 +1,36 @@ +subroutine sh65snr(x,nz,snr) + + real x(nz) + + ipk=0 !Shut up compiler warnings. -db + smax=-1.e30 + do i=1,nz + if(x(i).gt.smax) then + ipk=i + smax=x(i) + endif + s=s+x(i) + enddo + + s=0. + ns=0 + do i=1,nz + if(abs(i-ipk).ge.3) then + s=s+x(i) + ns=ns+1 + endif + enddo + ave=s/ns + + sq=0. + do i=1,nz + if(abs(i-ipk).ge.3) then + sq=sq+(x(i)-ave)**2 + ns=ns+1 + endif + enddo + rms=sqrt(sq/(nz-2)) + snr=(smax-ave)/rms + + return +end subroutine sh65snr |
