Main Content

Time Feature Extractor

Extract time-domain features from signals

Since R2025a

  • Time Feature Extractor block icon

Libraries:
DSP System Toolbox / Feature Extractors

Description

The Time Feature Extractor block extracts time-domain features from a signal. You can extract these time-domain features: mean, root mean square (RMS), standard deviation, shape factor, signal-to-noise ratio (SNR), total harmonic distortion (THD), signal to noise and distortion ratio (SINAD), peak value, crest factor, clearance factor, and impulse factor.

Examples

expand all

Extract the mean and standard deviation of a sinusoidal signal using the Time Feature Extractor block.

Open the SignalFeaturesSinuoid.slx model. The input is a sinusoidal signal with a time-variant scale and offset values. The sinusoid has a frequency of 10 Hz and a sample rate of 1000 Hz. The sinusoid is scaled and offset using two randomly uncorrelated signals. The input can be expressed as x(t) = A*sin(2*pi*f*t + p) + B, where f = 10, p = 0, A is the scale, and B is the offset.

Extract the mean and standard deviation of the input signal. In the Time Feature Extractor block, set the Window length parameter to 100 and Overlap length to 0. Select Mean and Standard deviation to extract these features. The Time Feature Extractor block now models a feature extraction pipeline to output the mean and standard deviation features from the input signal.

Display the input signal and the extracted features in a Scope block. Use a Demux block to separate the extracted features and connect the outputs to the Scope block.

Run the model and visualize the input signal with time-variant scales and offsets, the mean, and the standard deviation features.

Extract the RMS, crest factor, and impulse factor features from a multichannel signal.

Open the TimeFeaturesTwoWhales.slx model. The two-channel input signal x comes from a preloaded dataset labelwhalesignals that includes two recordings of blue whale songs that contain trills and moans. For more information about the whale songs dataset, see Label Signal Attributes, Regions of Interest, and Points.

The signal x is trimmed from the songs whale1 and whale2 in the moan region, which are sampled at 4 kHz.

Here is the MATLAB® code to plot the input signal x.

   load labelwhalesignals
   x = [whale1(24701:28200) whale2(28201:31700)];
   t = 1/Fs*([(24701:28200)' (28201:31700)']-1);
   plot(t,x)
   legend(["whale1" "whale2"])

Extract the root mean square (RMS), crest factor, and impulse factor features of the input signal x. In the Time Feature Extractor block, set the Window length parameter to 64 and Hop size to 50. Select RMS, Crest factor and Impulse factor to extract these features. The Time Feature Extractor block now models a feature extraction pipeline to output the time-domain features from the input signal.

Display the extracted features using Scope blocks. The Features by Whale scope shows the features for each whale in a separate display. The Individual Features scope shows each feature for each whale in a separate display. Use Demux blocks to separate the extracted features and connect the outputs to the Scope blocks.

Run the model and visualize the RMS, crest factor, and impulse factor features for whale1 and whale2 moans.

Ports

Input

expand all

Specify the input signal as a vector or as a matrix. Specify real- or complex-valued multichannel inputs of the size m-by-n, where m ≥ 1 is the signal length, and n ≥ 1 is the number of channels.

The block supports complex-valued signals at this port except when you enable the SINAD, SNR, and THD features.

Data Types: single | double

Output

expand all

Extracted features, returned as a vector or 3-D array.

  • For a single-channel input signal specified as a vector with m elements, the block returns the extracted features as a 1-by-r vector, where r is the number of features extracted from the signal

  • For an n-channel input signal specified as a matrix of size m-by-n, the block returns the extracted features as a 1-by-r-by-n array, where r is the number of features extracted from the signal.

Each column of the output signal corresponds to a different feature extracted from the input signal. For more information, see the Feature to output mapping parameter.

The sample time at this port equals Ts × HS, where Ts is the sample time (or the sample period) at the input port, and HS is the hop size between adjacent windows. Hop size equals WLOL, where WL is the window length and OL is the overlap length. For more information on block sample times, see Sample- and Frame-Based Concepts.

Data Types: double
Complex Number Support: Yes

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Signal buffering

Specify the number of samples per frame as a positive integer. The block divides the signal into frames of the specified length and extracts features for each frame.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the buffering method as one of these:

  • Overlap length — Number of overlapping samples between consecutive frames

  • Hop size — Number of samples between the start of frames

Specify the number of overlapping samples between consecutive frames as a nonnegative integer less than the window length.

Dependencies

To enable this parameter, set Specify to Overlap length.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the number of samples between the start of frames as a positive integer.

Dependencies

To enable this parameter, set Specify to Hop size.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Features to extract

Select this parameter to extract the mean value of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

For more information about the mean feature, see mean.

Select this parameter to extract the root mean square (RMS) of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

For more information about the root mean square feature, see rms.

Select this parameter to extract the standard deviation of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

For more information about the standard deviation feature, see std.

Select this parameter to extract the shape factor of the input signal. The shape factor is equal to the RMS value divided by the mean absolute value of the signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

Select this parameter to extract the signal-to-noise ratio (SNR) of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

Note

You must specify a real-valued input signal to extract this feature.

For more information about the signal-to-noise ratio feature, see snr.

Select this parameter to extract the total harmonic distortion (THD) of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

Note

You must specify a real-valued input signal to extract this feature.

For more information about the total harmonic distortion feature, see thd.

Select this parameter to extract the signal to noise and distortion ratio (SINAD) in decibels of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

Note

You must specify a real-valued input signal to extract this feature.

For more information about the signal to noise and distortion ratio feature, see sinad.

Select this parameter to extract the peak value of the input signal.

The peak value corresponds to the largest absolute value of the signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

Select this parameter to extract the crest factor of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

The crest factor is equal to the peak value divided by the RMS value of the signal. For more information about the crest factor feature, see peak2rms.

Select this parameter to extract the clearance factor of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

The clearance factor is equal to the peak value divided by the squared mean of the square roots of the absolute amplitude of the signal.

Select this parameter to extract the impulse factor of the input signal.

If you select this parameter, the feature-extractor block enables this feature for extraction, extracts this feature, and concatenates it with all the other features that you enable in the block.

The impulse factor is equal to the peak value divided by the mean of the absolute amplitude.

Expand this section to display the column index of each feature in the output. Each feature extracted from the input signal appears in a separate column of the output. For each feature listed in the Feature section of the table, the corresponding entry in the Column index in output section displays the column index where the feature appears in the output signal.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

More About

expand all

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2025a