Main Content

setScalarizationMethods

Set scalarization methods for feature extractor object

Since R2024a

    Description

    setScalarizationMethods(sFE,featurename) sets the ScalarizationMethod property of the signalTimeFrequencyFeatureExtractor object sFE by specifying an empty list of scalarization methods for the signal feature featurename.

    setScalarizationMethods(sFE,featurename,params) sets scalarization methods params for the signal feature featurename in the ScalarizationMethod property of the signalTimeFrequencyFeatureExtractor object sFE.

    example

    Examples

    collapse all

    Extract the spectral kurtosis and spectral crest from the Fourier synchrosqueezed transform of a sinusoidal signal. Set scalarization methods to extract the impulse factor and peak value for the spectral kurtosis feature.

    Create a time-frequency feature extractor object that returns the spectral kurtosis and spectral crest features from the Fourier synchrosqueezed transform of a sinusoidal signal.

    x = sin(2*pi*(0:0.1:1));
    tfFE = signalTimeFrequencyFeatureExtractor( ...
        Transform="synchrosqueezedspectrogram", ...
        SpectralKurtosis=true,SpectralCrest=true);

    Specify the scalarization methods to the time-frequency feature extractor object to extract the impulse factor and peak value for the spectral kurtosis feature. This operation sets up the ScalarizationMethod property in tfFE.

    setScalarizationMethods(tfFE,"SpectralKurtosis",...
                                ImpulseFactor=true,PeakValue=true)
    disp(tfFE.ScalarizationMethod)
      timeFrequencyScalarFeatureOptions with properties:
    
              SpectralKurtosis: [2x1 string]
              SpectralSkewness: [0x0 string]
                 SpectralCrest: [0x0 string]
              SpectralFlatness: [0x0 string]
               SpectralEntropy: [0x0 string]
                      TFRidges: [0x0 string]
        InstantaneousBandwidth: [0x0 string]
        InstantaneousFrequency: [0x0 string]
           InstantaneousEnergy: [0x0 string]
            MeanEnvelopeEnergy: [0x0 string]
                  TimeSpectrum: [0x0 string]
                WaveletEntropy: [0x0 string]
                 ScaleSpectrum: [0x0 string]
                           All: [0x0 string]
    

    Extract the vector and scalar features from the Fourier synchrosqueezed transform of x. Display the indices corresponding to the extracted features from the returned feature matrix. The feature extraction returns the spectral kurtosis vector followed by the impulse factor and the peak value scalar features, and then appends the spectral crest vector.

      [features,info] = extract(tfFE,x);
      info
    info = struct with fields:
                     SpectralKurtosis: [1 2 3 4 5 6 7 8 9 10 11]
        SpectralKurtosisImpulseFactor: 12
            SpectralKurtosisPeakValue: 13
                        SpectralCrest: [14 15 16 17 18 19 20 21 22 23 24]
    
    

    Input Arguments

    collapse all

    Feature extractor object, specified as a signalTimeFrequencyFeatureExtractor object.

    Name of the signal feature, specified as a string scalar or a character vector.

    Data Types: char | string

    Scalarization methods associated with featurename, specified as name-value arguments or a structure array. You can specify multiple name-value arguments.

    • Specify params as name-value arguments, where:

      • Name — Name of the scalarization method. Specify Name as ClearanceFactor, Mean, CrestFactor, PeakValue, ImpulseFactor, Energy, StandardDeviation, Kurtosis, Skewness, or Entropy. For more information, see Scalarization Methods for Domain-Specific Signal Features.

      • Value — Logical value of the scalarization method. Specify Value as either true or false.

    • Specify params as a struct array, where the field name is the name of the scalarization method and the value is either true or false.

    Note

    The scalarization method Entropy is not supported if you specify featurename as either WaveletEntropy or SpectralEntropy.

    Example: setScalarizationMethods(sFE,"SpectralCrest",PeakValue=true,Mean=true) and setScalarizationMethods(sFE,"SpectralCrest",struct("PeakValue",true,"Mean",true)) set the peak value and the mean as scalarization methods for the spectral crest feature in the signalTimeFrequencyFeatureExtractor object sFE using name-value arguments and structure arrays, respectively.

    More About

    collapse all

    Scalarization Methods for Domain-Specific Signal Features

    To set the scalarization methods for features in time domain, frequency domain, or time-frequency domain, select the domain-specific feature extractor objects and scalarization method specification. Refer to the following table for the list of domain-specific features from which you can extract scalar features.

    Feature domainFeature extractor objectScalarization method specificationFeatures that support scalarization
    TimesignalTimeFeatureExtractortimeScalarFeatureOptions objectPeakValue
    FrequencysignalFrequencyFeatureExtractorfrequencyScalarFeatureOptions objectPeakAmplitude
    WelchPSD
    Time-frequencysignalTimeFrequencyFeatureExtractortimeFrequencyScalarFeatureOptions objectAll time-frequency features

    For a given feature vector v with N elements, the scalarization method options convert v to a scalar s as follows.

    All Signal Domains
    • "Mean" — Mean, defined as the average value of v.

      s=v¯=1Ni=1Nvi

    • "StandardDeviation" — Standard deviation of the elements of v, normalized by N-1.

      s=1N1i=1N|viv¯|2

    • "PeakValue" — Peak value, defined as the maximum absolute value of v.

      s=vp=maxi|vi|

    • "Kurtosis" — Kurtosis, defined as the ratio between the fourth moment of v and the squared second moment of v.

      s=1Ni=1N(viv¯)4[1Ni=1N(viv¯)2]2

    • "Skewness" — Skewness, defined as the ratio between the third moment of v and the second moment of v raised to the power of 1.5.

      s=1Ni=1N(viv¯)3[1Ni=1N(viv¯)2]3/2

    Frequency and Time-Frequency Signal Domains
    • "ClearanceFactor" — Clearance factor, defined as the ratio between the peak value of v and the squared mean of the square roots of the absolute values of v.

      s=vp(1Ni=1N|vi|)2

    • "CrestFactor" — Crest factor, defined as the ratio between the peak value of v and the root-mean-square value of v.

      s=vp1Ni=1Nvi2

    • "Energy" — Energy, defined as the sum of the squared values of v.

      s=i=1Nvi2

    • "Entropy" — Entropy, defined as the sum of plog2p values, where p is the vector of normalized squared values of v with respect to their sum.

      s=i=1Npilog2pi,

      where

      p=v2i=1Nvi2.

      Note

      The scalarization method "Entropy" is not supported for the WaveletEntropy nor the SpectralEntropy features.

    • "ImpulseFactor" — Impulse factor, defined as the ratio between the peak value of v and the average absolute value of v.

      s=vp1Ni=1N|vi|

    Tips

    • Use the getScalarizationMethods function to return the list of scalarization methods for the features that you enabled when creating the feature extractor object.

    Version History

    Introduced in R2024a