Skip to main content
. 2023 Jun 23;23(13):5850. doi: 10.3390/s23135850
Algorithm 2 CalcFeatures_cwt function
  •   1:

    procedure CalcFeatures_cwt(x,waveletname,level)

  •   2:

        feature_levelsemptylist

  •   3:

        for ii{0,1,,level1} do

  •   4:

            (x,coeff_d)DWT(x,waveletname)

  •   5:
            Calculate statistical features for x:
    • wave_y1mean(x)
    • wave_y2max(x)
    • wave_y3RMS(x)
    • wave_y4std(x)
    • wave_y5std(x)/mean(x)
    • wave_y6max(x)/mean(x)
  •   6:
            Calculate statistical features for coeff_d:
    • wave_coef_y1mean(coeff_d)
    • wave_coef_y2max(coeff_d)
    • wave_coef_y3RMS(coeff_d)
    • wave_coef_y4std(coeff_d)
    • wave_coef_y5std(coeff_d)/mean(coeff_d)
    • wave_coef_y6max(coeff_d)/mean(coeff_d)
    • wave_coef_n55%percentile(coeff_d)
    • wave_coef_n2525%percentile(coeff_d)
    • wave_coef_n7575%percentile(coeff_d)
    • wave_coef_n9595%percentile(coeff_d)
  •   7:

             features(wave_y1,wave_y2,wave_y3,wave_y4,wave_y5,wave_y6,

                   wave_coef_y1,wave_coef_y2,wave_coef_y3,wave_coef_y4,

                   wave_coef_y5,wave_coef_y6,wave_coef_n5,wave_coef_n25,wave_coef_n75,

                   wave_coef_n95)

  •   8:

            Append features to feature_levels

  •   9:

        end for

  • 10:

        outputFlatten(feature_levels)

  • 11:

        return output

  • 12:

    end procedure