6
"github.com/RB-PRO/ssa/pkg/oss"
7
"github.com/RB-PRO/ssa/pkg/pchip"
8
"gonum.org/v1/gonum/mat"
11
// # Расчёт мгновенной частота нормированной АКФ сингулярных троек sET12 для сегментов pw
12
func Instantaneous_frequency_of_normalized_ACF_sET12(AcfNrm_sET12 mat.Dense, S, lag int, dt float64, lgl []float64) ([]float64, error) {
13
insFrc_AcfNrm := make([]float64, S)
14
for j := 0; j < S; j++ {
15
PhaAcfNrm := MakePhaAcfNrm(AcfNrm_sET12.ColView(j))
17
//_, _, coef := pchip.Pchip(oss.VecDense_in_float64(*PhaAcfNrm), lgl, lgl, PhaAcfNrm.Len(), len(lgl))
19
//fmt.Println(len(lgl), PhaAcfNrm.Len())
21
slopes := pchip.Pchip2(lgl, oss.VecDense_in_float64(*PhaAcfNrm))
23
//spline := pchip.NewCubic(lgl, oss.VecDense_in_float64(PhaAcfNrm))
25
//oss.SafeToXlsx(pCoef, "pCoef")
26
//oss.SafeToXlsxDualArray(pCoef, "pCoef")
27
//fmt.Println(pAcf[0], len(pCoef))
29
FrcAcfNrm := make([]float64, lag)
30
for m := 1; m < lag; m++ {
32
//FrcAcfNrm[m] = math.Abs(coef.B[m-1]) / (2.0 * math.Pi) / dt // pchip
33
FrcAcfNrm[m] = math.Abs(slopes[m-1]) / (2.0 * math.Pi) / dt // pchip
35
//FrcAcfNrm[m] = math.Abs(spline.Weights[m-1]) / (2.0 * math.Pi * dt) // spline
37
FrcAcfNrm[0] = FrcAcfNrm[1]
38
insFrc_AcfNrm[j] = oss.Median_floatArr(FrcAcfNrm) // средняя(медианная) мгновенная частотта j-го сегмента pw
40
return insFrc_AcfNrm, nil