ssa
1package movmean2
3import (4"fmt"5"testing"6)
7
8func TestMovmean(t *testing.T) {9// https://www.mathworks.com/help/matlab/ref/movmean.html10// A = [4 8 6 -1 -2 -3 -1 3 4 5];11// M = movmean(A,3)12// M = 1×1013// 6.0 6.0 4.3 1.0 -2.0 -2.0 -0.3 2.0 4.0 4.514A := []float64{4.0, 8.0, 6.0, -1.0, -2.0, -3.0, -1.0, 3.0, 4.0, 5.0}15k := 316
17result, _ := Movmean(A, k)18fmt.Println(len(result))19for _, res := range result {20fmt.Printf("%.2f ", res)21}22}
23