# Extract Spectral Features

Interactively extract spectral fault band metrics in the Live Editor

## Description

The **Extract Spectral Features** task lets you
interactively extract spectral fault band metrics. The task helps with analyzing and
understanding spectral data. Using a comprehensive interface, you can add components to
represent various bearings, gear meshes, or other parts of your hardware setup. As you set the
physical parameters of these components, the **Extract Spectral
Features** Live Editor task will plot fault frequency bands at the
characteristic frequencies of the components. You can overlay power spectrum data on the fault
band plot to associate various peaks in the data with the components' characteristic
frequencies. This can make fault detection and fault isolation easier, as changes in the power
spectrum data can easily be traced back to the physical components causing them. In addition
to a plot of the characteristic frequencies and the power spectrum data, the task will
generate spectral metrics of the data within each characteristic frequency band. The output
metrics table containing the peak amplitude, peak frequency, and band power of each band aids
in characterizing potential mechanical faults. The task automatically generates MATLAB^{®} code for your live script. For more information about Live Editor tasks
generally, see Add Interactive Tasks to a Live Script.

## Open the Task

To add the **Extract Spectral Features** task to a live
script in the MATLAB Editor:

On the

**Live Editor**tab, select**Task**>**Extract Spectral Features**.In a code block in your script, type a relevant keyword, such as

`fault bands`

or`metrics`

. Select`Extract Spectral Features`

from the suggested command completions.

## Parameters

**Select power spectrum data**

`Frequency vector`

— Frequencies corresponding to the power spectrum data

vector

Select a vector of frequencies from the MATLAB workspace that correspond to your power spectrum data.

`Power spectrum magnitude`

— Power spectrum magnitude data

vector

Select a vector containing the power spectrum magnitudes from the MATLAB workspace.

**Configure components**

`Add component`

— Bearing, gear mesh or custom hardware representation

'`Bearing`

' | '`Gear mesh`

' | '`Custom`

'

Choose between adding a bearing, gear mesh or a custom component. You can name your
component and then click the **Add** button. You can set the physical
characteristics of these components using the parameters below. The
**Extract Spectral Features** Live Editor task will plot
fault frequency bands at the characteristic frequencies of the components.

**Bearing Component Parameters**

`Enable component`

— Toggle to enable or disable component for spectral metrics computation

`on`

(default) | `off`

You can toggle this option to enable or disable the component from being included in
the spectral metrics computation. Disabling the component will also remove its fault
bands from the plot. Use the **Delete** button to permanently remove
a component.

`Number of balls`

— Number of balls or rollers in the bearing

10 (default) | positive integer

Specify the number of rolling elements in the bearing.

`Pitch diameter`

— Pitch diameter of the bearing

35 (default) | positive scalar

Pitch diameter of the bearing is the diameter of the circle that the center of the ball or roller travels during the bearing rotation.

`Rotational speed`

— Rotational speed of the shaft or inner race of the bearing

60 (default) | positive scalar

Rotational speed of the shaft or inner race of the bearing. It is the fundamental
frequency around which the **Extract Spectral Features**
live task generates the fault frequency bands. The units must be consistent with the
unit of the frequency vector.

`Contact angle`

— Bearing contact angle

0 (default) | non-negative scalar

Contact angle in degrees between a plane perpendicular to the ball or roller axis and the line joining the two raceways.

`Ball diameter`

— Diameter of the ball or roller

10 (default) | positive scalar

Diameter of the ball or roller in the bearing.

`Harmonics`

— Harmonics of the fundamental frequency to be included

`1`

(default) | vector of positive integers

Specify the harmonics of the fundamental frequency to be included in the plot and in the spectral metrics computation.

`Sidebands`

— Sidebands around the fundamental frequency and its harmonics to be included

`0`

(default) | vector of nonnegative integers

Specify the sidebands around the fundamental frequency and its harmonics to be included in the plot and in the spectral metrics computation.

`Domain`

— Units of the fault band frequencies

`'frequency'`

(default) | `'order'`

Specify the units of the fault band frequencies as either
`'frequency'`

or `'order'`

. Select:

`'frequency'`

if you have the fault bands in the same units as the**Rotational speed**.`'order'`

if you have the fault bands as number of rotations relative to the inner race rotation**Rotational speed**.

`Band width`

— Width of the frequency bands centered at the nominal fault frequencies

auto (default) | positive scalar

Specify the width of the frequency bands centered at the nominal fault frequencies
as a positive scalar. Uncheck the **Auto** option to specify the width
value manually.

**Gear Mesh Component Parameters**

`Enable component`

— Toggle to enable or disable component for spectral metrics computation

`on`

(default) | `off`

You can toggle this option to enable or disable the component from being included in
the spectral metrics computation. Disabling the component will also remove its fault
bands from the plot. Use the **Delete** button to permanently remove
a component.

`Input gear teeth`

— Number of teeth on the input gear

10 (default) | positive integer

Specify the number of teeth on the input gear as a positive integer.

`Output gear teeth`

— Number of teeth on the output gear

40 (default) | positive integer

Specify the number of teeth on the output gear as a positive integer.

`Rotational speed`

— Rotational speed of the input gear

60 (default) | positive scalar

Specify the rotational speed of the input gear as a positive scalar. It is the
fundamental frequency around which the **Extract Spectral
Features** live task generates the fault frequency bands. The units
must be consistent with the unit of the frequency vector.

`Harmonics`

— Harmonics of the fundamental frequency to be included

`1`

(default) | vector of positive integers

Specify the harmonics of the fundamental frequency to be included in the plot and in the spectral metrics computation.

`Sidebands`

— Sidebands around the fundamental frequency and its harmonics to be included

`0`

(default) | vector of nonnegative integers

Specify the sidebands around the fundamental frequency and its harmonics to be included in the plot and in the spectral metrics computation.

`Domain`

— Units of the fault band frequencies

`'frequency'`

(default) | `'order'`

Specify the units of the fault band frequencies as either
`'frequency'`

or `'order'`

. Select:

`'frequency'`

if you have the fault bands in the same units as the**Rotational speed**.`'order'`

if you have the fault bands as number of rotations relative to the**Rotational speed**.

`Band width`

— Width of the frequency bands centered at the nominal fault frequencies

auto (default) | positive scalar

Specify the width of the frequency bands centered at the nominal fault frequencies
as a positive scalar. Uncheck the **Auto** option to specify the width
value manually.

**Custom Component Parameters**

`Enable component`

— Toggle to enable or disable component for spectral metrics computation

`on`

(default) | `off`

You can toggle this option to enable or disable the component from being included in
the spectral metrics computation. Disabling the component will also remove its fault
bands from the plot. Use the **Delete** button to permanently remove
a component.

`Frequency`

— Fundamental frequency of interest

60 (default) | positive scalar

Specify fundamental frequency of interest as a positive scalar. The
**Extract Spectral Features** live task constructs the
fault frequency bands around the fundamental frequency. For instance, to construct fault
bands for a faulty induction motor, the mains frequency of 60 Hz is the fundamental
frequency of interest. Similarly, to generate fault bands for a faulty gear train, the
input shaft frequency is the fundamental frequency.

`Harmonics`

— Harmonics of the fundamental frequency to be included

`1`

(default) | vector of positive integers

Specify the harmonics of the fundamental frequency to be included in the plot and in the spectral metrics computation.

`Sidebands`

— Sidebands around the fundamental frequency and its harmonics to be included

`0`

(default) | vector of nonnegative integers

Specify the sidebands around the fundamental frequency and its harmonics to be included in the plot and in the spectral metrics computation.

`Separation type`

— Type of separation between successive sidebands

`'additive'`

(default) | `'multiplicative'`

Specify the type of separation between successive sidebands as either
`'additive'`

or `'multiplicative'`

. Select:

`'additive'`

, to set the separation between successive sidebands to`0.1*F1`

value, where`F1`

is the distance of the first sideband from the fundamental frequency.`'multiplicative'`

, to set the separation between successive sidebands proportional to both the harmonic order and the sideband value.

`Separation`

— Separation value between successive sidebands

`Auto`

(default) | positive scalar

Specify the separation value between successive sidebands as a positive scalar.
Uncheck the **Auto** option to specify the separation value
manually.

`Band width`

— Width of the frequency bands centered at the nominal fault frequencies

auto (default) | positive scalar

Specify the width of the frequency bands centered at the nominal fault frequencies
as a positive scalar. Uncheck the **Auto** option to specify the width
value manually.

`Folding`

— Toggle to specify whether negative nominal fault frequencies have to be folded about the frequency origin

`off`

(default) | `on`

Toggle to specify whether negative nominal fault frequencies have to be folded about
the frequency origin. If you turn **Folding**
`on`

, then the **Extract Spectral
Features** live task folds the negative nominal fault frequencies about
the frequency origin by taking their absolute values such that the folded fault bands
always fall in the positive frequency intervals. The folded fault bands are computed as $$\left[\text{max}\left(0,\text{}\left|F\right|-\frac{W}{2}\right),\text{}\left|F\right|+\frac{W}{2}\right]$$, where `W`

is the **Band width** and
`F`

is the **Frequency**.

**Display results**

`Spectral metrics`

— Toggle to enable or disable the display of spectral metrics

`off`

(default) | `on`

Toggle this option enable or disable the display of spectral metrics. When the
option is checked, then the **Extract Spectral Features**
live task displays the metrics as a `1xN`

table, where ```
N =
3*size((F+S),1)+1
```

, that is three metrics per frequency range and the total
band power over the frequency range.

The live task returns the following spectral metrics for each frequency range:

`Peak Amplitude`

— Peak amplitude value for each specified frequency range.`Peak Frequency`

— Peak frequency value for each specified frequency range.`Band Power`

— Average power of each frequency range. For more information on band power, see`bandpower`

.`Total Band Power`

— Sum of individual band powers for the set of specified frequency ranges.

## Version History

**Introduced in R2021a**

## See Also

`faultBands`

| `gearMeshFaultBands`

| `bearingFaultBands`

| `faultBandMetrics`