Engee documentation

spectralEntropy

Spectral entropy of signals and spectrograms.

Library

EngeeDSP

Syntax

Function call

  • se = spectralEntropy(x,f) — returns the spectral entropy of the signal x in time. Argument x it is set as a signal in the time or frequency domain, and f — how is the sampling rate (Hz) or a frequency vector (Hz). Interpretation x the function depends on the form f.

  • se = spectralEntropy(___,Name,Value) — sets parameters using one or more name-value arguments.

  • spectralEntropy(___;out=:plot) — plots the spectral entropy. You can specify an input combination of any of the above syntax options.

    • If the input signal is in the time domain, the spectral entropy graph is plotted as a function of time.

    • If the input signal is in the frequency domain, the spectral entropy graph is plotted depending on the frame number.

Arguments

Input arguments

# x is an input signal in the time or frequency domain

+ column vector | the matrix

Details

An input signal in the time or frequency domain, specified as a vector or matrix.

x it must be substantial.

Interpretation x the function depends on the form f.

For more information about signal area specifications and valid syntaxes, see Spectral entropy specifications for the signal domain.

Типы данных

Float32, Float64

# f is the sampling frequency (Hz) or frequency vector (Hz)
1 (by default) | scalar | vector

Details

Sampling rate (Hz) or a vector of frequencies (Hz), specified as a numeric scalar or vector, respectively. Interpretation x the function depends on the form f:

  • If f — numeric scalar, function spectralEntropy interprets x as a signal in the time domain, and f — as a sampling rate in Hz. In this case x must be a real vector or a matrix. If x — the matrix, spectralEntropy interprets columns as separate channels.

  • If f — numeric vector, function spectralEntropy interprets x as a signal in the frequency domain, and f — as a frequency vector in Hz corresponding to the lines x. In this case x must be a real array of size , where — the number of spectral values at the specified frequencies f, — the number of individual spectra, and — the number of channels.

    Number of rows in x must be equal to the number of elements f.

For more information about signal area specifications and valid syntaxes, see Spectral entropy specifications for the signal domain.

Типы данных

Float32, Float64

Name-value input arguments

Specify optional argument pairs as Name,Value, where Name — the name of the argument, and Value — the appropriate value. Name-value arguments should be placed after other arguments, but the order of the pairs does not matter.

Use commas to separate the name and value, and Name put it in quotation marks.

  • If x — a time domain signal, you can specify any name-value argument for time domain or for both areas.

  • If x — a frequency domain signal, you can specify any name-value argument for both areas.

If you specify other arguments of the "name-value" type, the function spectralEntropy it may ignore the specified values or give an error. For more information about signal area specifications and valid syntaxes, see Spectral entropy specifications for the signal domain.

temporal area

# Window — the window used in the time domain

+ rectwin(round(f*0.03)) (by default) | vector

Details

The window used in the time domain, defined as a real vector. The number of vector elements must be in the range [1,size(x,1)]. The number of vector elements should also be greater. OverlapLength. If the argument is Window not specified, function spectralEntropy uses the length of the window, which splits x into eight overlapping segments.

Типы данных

Float32, Float64

# OverlapLength — the number of samples overlapping between adjacent windows

+ round(f*0.02) (by default) | a non-negative scalar

Details

The number of samples overlapping between adjacent windows, set as an integer in the range [0,size(Window,1)). If the argument is OverlapLength not specified, function spectralEntropy uses a value that provides 50% overlap between segments.

Типы данных

Float32, Float64

# FFTLength — the number of elements in the DFT

+ numel(Window) (by default) | a positive integer scalar

Details

The number of elements used to calculate the DFT of window input samples, set as a positive integer scalar. If no argument is given, FFTLength by default, it is equal to the number of elements in Window.

Типы данных

Float32, Float64

# SpectrumType — spectrum type

+ "power" (by default) | "magnitude"

Details

The type of spectrum specified as "power" or "magnitude":

  • "power" — spectral entropy is calculated for a one-sided power spectrum;

  • "magnitude" — spectral entropy is calculated for a one-sided amplitude spectrum.

Типы данных

String

temporal and frequency domains

# Range — frequency range (Hz)

+ [0,f/2] (by default) | A two-element vector is a string

Details

The frequency range in Hz, defined as a two-element vector, is a string of increasing real values in the range [0,f/2].

Типы данных

Float32, Float64

# out — type of output data

+ :data (by default) | :plot

Details

Type of output data:

  • :data — the function returns data;

  • :plot — the function returns a graph.

Output arguments

# se — spectral entropy

+ scalar | vector | the matrix

Details

The spectral entropy returned as a scalar, vector, or matrix. Each line se corresponds to the spectral entropy of the window x. Each column se corresponds to an independent channel.

Additional Info

Spectral entropy

Details

The spectral entropy (SE) of a signal is a measure of the distribution of its spectral power. This concept is based on Shannon entropy, or information entropy, in information theory. SE considers the normalized distribution of signal power in the frequency domain as a probability distribution and calculates its Shannon entropy. In this context, the Shannon entropy is the spectral entropy of a signal. This property can be useful for extracting features during fault detection and diagnosis [2], [1]. SE is also widely used as a feature in speech recognition [3] and biomedical signal processing [4].

The equations for spectral entropy follow from the equations for the power spectrum and the probability distribution of the signal. For the signal The power spectrum is , where — discrete Fourier transform of . Probability distribution in this case, it is equal to

Spectral entropy calculated as follows

Rationing:

where — the total number of frequency points. The denominator It represents the maximum spectral entropy of white noise, evenly distributed in the frequency domain.

If the time-frequency power spectrogram is known , then the probability distribution takes the form

The spectral entropy is still equal to

To calculate the instantaneous spectral entropy from a given time-frequency power spectrogram , probability distribution at a time equally

Then the spectral entropy at a time is equal to

Spectral entropy specifications for the signal domain

Details

You can set the signals in the time or frequency domain, and the function spectralEntropy returns the spectral entropy of the specified signal. Depending on the signal area, you can specify the following input arguments and syntax.

Area x f Acceptable syntaxes Valid name-value arguments

Temporary

Column vector

The matrix

Numeric scalar (sampling rate)

spectralEntropy(x,f)

Window

OverlapLength

FFTLength

SpectrumType

Range

Frequency

The matrix

An array of size

Vector from elements (frequency vector)

spectralEntropy(x,f) spectralEntropy(x,f,t)

Range

Algorithms

The function calculates the spectral entropy as described in [5]:

where

  • — spectral value in bin ;

  • and — band boundaries in bins, which are used to calculate spectral entropy.

Literature

  1. Pan, Y. N., J. Chen, and X. L. Li. «Spectral Entropy: A Complementary Index for Rolling Element Bearing Performance Degradation Assessment.» Proceedings of the Institution of Mechanical Engineers, Part C: Journal of Mechanical Engineering Science. Vol. 223, Issue 5, 2009, pp. 1223–1231.

  2. Sharma, V., and A. Parey. «A Review of Gear Fault Diagnosis Using Various Condition Indicators.» Procedia Engineering. Vol. 144, 2016, pp. 253–263.

  3. Shen, J., J. Hung, and L. Lee. «Robust Entropy-Based Endpoint Detection for Speech Recognition in Noisy Environments.» ICSLP. Vol. 98, November 1998.

  4. Vakkuri, A., A. Yli‐Hankala, P. Talja, S. Mustola, H. Tolvanen‐Laakso, T. Sampson, and H. Viertiö‐Oja. «Time‐Frequency Balanced Spectral Entropy as a Measure of Anesthetic Drug Effect in Central Nervous System during Sevoflurane, Propofol, and Thiopental Anesthesia.» Acta Anaesthesiologica Scandinavica. Vol. 48, Number 2, 2004, pp. 145–153.

  5. Misra, H., S. Ikbal, H. Bourlard, and H. Hermansky. «Spectral Entropy Based Feature for Robust ASR.» 2004 IEEE International Conference on Acoustics, Speech, and Signal Processing.