Finds the location of the signal using a similarity search.
Library
EngeeDSP
Syntax
Function call
istart, istop, dist = findsignal(data, signal) —
returns the start and end indexes of a segment of the data array data, which best matches the search array signal. The segment for which the square of the Euclidean distance between the segment and the search array is considered the best match. dist is the smallest. If data and signal — matrices, then findsignal finds the start and end columns of the array data, which best matches signal. In this case data and signal they must have the same number of rows.
istart, istop, dist = findsignal(data, signal, Name,Value) —
uses additional parameters specified by one or more arguments Name,Value. The parameters include the normalization applied, the number of segments for the report, and the distance metric used.
Specify optional argument pairs in the format 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.
The normalization length, set as an integer scalar. This value represents the minimum number of samples by which each sample is normalized in both the data and the signal. If the signal is a matrix, then NormalizationLength represents the number of columns.
The maximum segment distance, set as a positive real scalar. If specified MaxDistance Then findsignal returns the start and end indexes of all segments data, the distances of which from signal are local minima and less MaxDistance.
Типы данных
Float32, Float64
#MaxNumSegments —
maximum number of segments returned
+
1 (by default) | scalar
Details
The maximum number of segments to return, set as a positive integer scalar. If specified MaxNumSegments Then findsignal finds all segments data, the distances of which from signal are local minima, and returns up to MaxNumSegments segments with the shortest distances.
The distance metric set as one of the values: "squared", "absolute", "euclidean" or "symmkl". If and are -measured signals, then the metric sets — the distance between -m countdown and -m countdown .
"squared" — the square of the Euclidean metric, consisting of the sum of the squares of the differences:
"euclidean" — the root of the sum of the squares of the differences, also known as the Euclidean metric or :
"absolute" — the sum of absolute differences, also known as the distance of city blocks, the Manhattan metric, the taxi metric, or :
"symmkl" — symmetric Kullback—Leibler metric. This metric is only true for real and positive numbers. and :
Output arguments
#istart, istop —
start and end indexes of the segment
+
scalar | vector
Details
The start and end indexes of the segment, returned as an integer scalar or vector.
The minimum distance between the data and the signal, returned as a scalar or vector.
Examples
Finding a signal in the data
Details
We will generate a data set consisting of a Gaussian pulse with a frequency of 5 Hz with bandwidth 50%, sampled for half a second with a frequency of 1 kHz. Let’s create a signal consisting of one and a half periods of a sine wave with a frequency of 10 Hz. Let’s plot the data set and the signal.
Let’s add two clearly missing sections to the dataset. Let’s find the segment that is closest to the signal (in terms of the smallest absolute distance). Let’s plot the data graph and highlight this segment.