# setScalarizationMethods

## Description

`setScalarizationMethods(`

sets the `sFE`

,`featurename`

)`ScalarizationMethod`

property of the `signalTimeFrequencyFeatureExtractor`

object `sFE`

by
specifying an empty list of scalarization methods for the signal feature
`featurename`

.

`setScalarizationMethods(`

sets scalarization methods `sFE`

,`featurename`

,`params`

)`params`

for the signal feature
`featurename`

in the `ScalarizationMethod`

property of
the `signalTimeFrequencyFeatureExtractor`

object `sFE`

.

## Examples

### Scalar Feature Extraction Using Scalarization Methods

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

`sFE`

— Feature extractor object

`signalTimeFrequencyFeatureExtractor`

object

Feature extractor object, specified as a `signalTimeFrequencyFeatureExtractor`

object.

`featurename`

— Signal feature name

string scalar | character vector

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

**Data Types: **`char`

| `string`

`params`

— Scalarization methods

name-value arguments | structure array

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

### 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 domain | Feature extractor object | Scalarization method specification | Features that support scalarization |
---|---|---|---|

Time | `signalTimeFeatureExtractor` | `timeScalarFeatureOptions` object | `PeakValue` |

Frequency | `signalFrequencyFeatureExtractor` | `frequencyScalarFeatureOptions` object | `PeakAmplitude` `WelchPSD` |

Time-frequency | `signalTimeFrequencyFeatureExtractor` | `timeFrequencyScalarFeatureOptions` object | All 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=\overline{v}=\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{v}_{i}}$$

`"StandardDeviation"`

— Standard deviation of the elements of*v*, normalized by*N*-1.$$s=\sqrt{\frac{1}{N-1}{\displaystyle \sum _{i=1}^{N}|{v}_{i}-\overline{v}{|}^{2}}}$$

`"PeakValue"`

— Peak value, defined as the maximum absolute value of*v*.$$s={v}_{p}=\underset{i}{\mathrm{max}}\left|{v}_{i}\right|$$

`"Kurtosis"`

— Kurtosis, defined as the ratio between the fourth moment of*v*and the squared second moment of*v*.$$s=\frac{\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{({v}_{i}-\overline{v})}^{4}}}{{\left[\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{({v}_{i}-\overline{v})}^{2}}\right]}^{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=\frac{\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{({v}_{i}-\overline{v})}^{3}}}{{\left[\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{({v}_{i}-\overline{v})}^{2}}\right]}^{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=\frac{{v}_{p}}{{\left(\frac{1}{N}{\displaystyle \sum _{i=1}^{N}\sqrt{\left|{v}_{i}\right|}}\right)}^{2}}$$

`"CrestFactor"`

— Crest factor, defined as the ratio between the peak value of*v*and the root-mean-square value of*v*.$$s=\frac{{v}_{p}}{\sqrt{\frac{1}{N}{\displaystyle \sum _{i=1}^{N}{v}_{i}{}^{2}}}}$$

`"Energy"`

— Energy, defined as the sum of the squared values of*v*.$$s={\displaystyle \sum _{i=1}^{N}{v}_{i}{}^{2}}$$

`"Entropy"`

— Entropy, defined as the sum of*p*log_{2}*p*values, where*p*is the vector of normalized squared values of*v*with respect to their sum.$$s={\displaystyle \sum _{i=1}^{N}{p}_{i}{\mathrm{log}}_{2}{p}_{i}},$$

where

$$p=\frac{{v}^{2}}{{\displaystyle \sum _{i=1}^{N}{v}_{i}{}^{2}}}.$$

**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=\frac{{v}_{p}}{\frac{1}{N}{\displaystyle \sum _{i=1}^{N}\left|{v}_{i}\right|}}$$

## 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**

## See Also

### Objects

### Functions

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)