You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import "gonum.org/v1/gonum/stat/distuv"
type point struct {
lat float64
lng float64
}
func smoothGPSData(data []point, sigma float64) []point {
smoothedData := make([]point, len(data))
x := make([]float64, len(data))
y := make([]float64, len(data))
// Extract the latitude and longitude data into separate slices
for i, p := range data {
x[i], y[i] = p.lat, p.lng
}
// Create a Gaussian distribution with sigma as the standard deviation
dist := distuv.Normal{
Mu: 0,
Sigma: sigma,
}
// Convolve the data with the Gaussian kernel
for i := range x {
for j := range y {
kernel := dist.Prob(x[i] - x[j])
smoothedData[i].lat += kernel * x[j]
smoothedData[i].lng += kernel * y[j]
}
}
return smoothedData
}
The text was updated successfully, but these errors were encountered:
https://github.com/gonum/gonum
The text was updated successfully, but these errors were encountered: