Converted from MATLAB script at http://billauer.co.il/peakdet.html
Download and install the repo
go get github.com/mpiannucci/peakdetectCall it on a slice
import "github.com/mpiannucci/peakdetect"
...
v := [...]float64{0.0,1.0,2.0,1.0,0.0,-1.0,0.0,3.0,0.0}
mini, minv, maxi, maxv := peakdetect.PeakDetect(v[:], 1.0)https://godoc.org/github.com/mpiannucci/peakdetect
Converted by Matthew Iannucci
Original by Eli Billauer, 3.4.05 (Explicitly not copyrighted). This function is released to the public domain; Any use is allowed.