calculate the short-time band power of a 1-D signal
calculate the short-time mean frequency of a 1-D signal
calculate the short-time spectral entropy of a 1-D signal
ShortTimeBandPower( signal, options )
ShortTimeMeanFrequency( signal, options )
ShortTimeSpectralEntropy( signal, options )
1-D rtable or list of data.
samplerate: (optional) Positive numeric value for the sampling rate. The default is 1.0.
overlapsize: (optional) Non-negative integer which specifies the target minimum overlap size of the segments. The default is 0.
segmentsize: (optional) Positive integer for the size of the overlapping segments. The default is the largest power of 2 that is not larger than the size of signal.
fftnormalization: (optional) One of none, symmetric, or full, indicates the normalization to be applied when using the Fast Fourier Transform (FFT). The default is symmetric.
temperendpoints: (optional) Either true or false, specifies whether the short-time power spectra are to be tempered at the endpoints. The default is false.
window: (optional) Either a list, name, or string, specifies the windowing command to be applied to the overlapping segments. The default is "none" (for no windowing to be applied). If a list is passed, the first element provides the name of the windowing command, and any remaining terms are passed as options to the command.
windownormalization (optional) Either true or false, indicates if the windowing function is to be normalized. The default is true.
frequencyunit: (optional) Unit which specifies the unit of frequency. The default is Unit(Hz). Either of the forms algebraic or Unit(algebraic) is accepted, and the unit must be convertible to a valid unit of frequency.
timeunit: (optional) Unit which specifies the unit of time. The default is Unit(s). Either of the forms algebraic or Unit(algebraic) is accepted, and the unit must be convertible to a valid unit of time.
frequencyrange: (optional) Range of numeric frequency values used to filter (i.e. band-limit) the data. If omitted, all frequencies are considered.
method: (optional) The method of numerical integration to be used to find band power. The options are leftendpoint, rightendpoint, simpson, and trapezoid. The default is trapezoid, which is equivalent to finding the area under the linear interpolation through all the points.
bandpowerplotoptions: (optional) List of additional plot options to be passed when creating the band power plot. The default is .
meanfrequencyplotoptions: (optional) List of additional plot options to be passed when creating the mean frequency plot. The default is .
entropyplotoptions: (optional) List of additional plot options to be passed when creating the entropy plot. The default is .
output: (optional) The type of output. The supported options are:
bandpower: Returns a Vector of float datatype containing the Short-Time Band Power (STBP). This is the default for ShortTimeBandPower.
bandpowerplot: Returns a plot of the bandpower Vector versus time.
entropy: Returns a Vector of float datatype containing the Short-Time Spectral Entropy (STSE). This is the default for ShortTimeSpectralEntropy.
entropyplot: Returns a plot of the entropy Vector versus time.
meanfrequency: Returns a Vector of float datatype containing the Short-Time Mean Frequency (STMF). This is the default for ShortTimeMeanFrequency.
meanfrequencyplot: Returns a plot of the meanfrequency Vector versus time.
signal: Returns a Matrix of float or complex datatype containing the signal, with each column representing a short-time segment.
stps: Returns a Matrix of float datatype containing the Short-Time Power Spectrum (STPS).
frequencies: Returns a Vector, of float datatype and length the same as signal, containing the frequencies.
times: Returns a Vector, of float datatype and length the same as signal, containing the times.
record: Returns a record with the previous options.
list of any of the above options: Returns an expression sequence with the corresponding outputs, in the same order.
The ShortTimeBandPower, ShortTimeMeanFrequency, and ShortTimeSpectralEntropy commands take a 1-D rtable or list signal, and first compute the Short-Time Power Spectrum (STPS) Matrix P using the ShortTimeFourierTransform command and the provided options. The Short-Time Band Power is the Vector B having elements Bj calculated as the band power of column j of P using the BandPower command and the provided options, including frequencyrange. The Short-Time Mean Frequency and Short-Time Spectral Entropy are defined in a similar way, and use, respectively, the MeanFrequency and SpectralEntropy commands.
The values of a=overlapsize, b=segmentsize, and n=numelems⁡signal must satisfy 2≤n, 0≤a, 2≤b, a<b, and b≤n.
Maple will attempt to coerce the provided signal to a 1-D Vector of either float or complex datatype, and an error will be thrown if this is not possible. For this reason, it is most efficient for the passed input to use this datatype.
The input signal cannot have an indexing function, and must use rectangular storage.
The ShortTimeBandPower, ShortTimeMeanFrequency, and ShortTimeSpectralEntropy commands are not thread safe.
STBP ≔ ShortTimeBandPower⁡1,10,2,9,3,8,4,segmentsize=4,overlapsize=2
STBP,STMF,STSE ≔ ShortTimeMeanFrequency⁡5,2,8,−3,6,segmentsize=3,overlapsize=1,output=bandpower,meanfrequency,entropy
First, construct a signal over time interval 0,2⁢π from a pure sinusoid:
signal_size ≔ 4096
sample_rate ≔ evalhf⁡signal_size−12⁢Pi
Times ≔ Vector⁡signal_size,i→evalhf⁡i−1sample_rate,datatype=float8
g ≔ t→2⁢sin⁡5⁢t3+7
Signal_Pure ≔ Vector⁡`~`g⁡Times,datatype=float8
Now, find the spectral entropy of the pure signal, along with the plot:
segment_size ≔ 64
overlap_size ≔ 0
Entropy_Vector_Pure,Entropy_Plot_Pure ≔ ShortTimeSpectralEntropy⁡Signal_Pure,samplerate=sample_rate,segmentsize=segment_size,overlapsize=overlap_size,output=entropy,entropyplot:
Second, we add some noise:
Noise ≔ Vectorcolumn⁡Sample⁡RandomVariable⁡Normal⁡0,5,signal_size
Signal_Noisy ≔ Signal_Pure+Noise
With noise, of course, the short-time entropy changes:
Entropy_Vector_Noisy,Entropy_Plot_Noisy ≔ ShortTimeSpectralEntropy⁡Signal_Noisy,samplerate=sample_rate,segmentsize=segment_size,overlapsize=overlap_size,output=entropy,entropyplot:
As we see from a plot of the original and noisy signals, the noise conceals the pure sinusoid:
dataplot⁡Times,Signal_Noisy,Signal_Pure,size=800,400,color=red,blue,style=line,legend=Noisy Signal,Pure Signal,labels=Time (s),Amplitude,title=Signal,font=Verdana,15,labelfont=Verdana,10,legendstyle=font=Verdana,15
However, the plot of the short-time spectral entropy indicates the locations where the original signal is strongest (namely, where the entropy is lowest and has the highest information content) and weakest (where the entropy is highest).
The SignalProcessing[ShortTimeBandPower], SignalProcessing[ShortTimeMeanFrequency] and SignalProcessing[ShortTimeSpectralEntropy] commands were introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
Download Help Document
What kind of issue would you like to report? (Optional)