Reference > Prepare Methods
segmentByLocalExtrema(x,y,dx,dataFilterLength,derivedFilterLength)
Definition
Integer segmentByLocalExtrema(Number x, Number y, Number dx, Number dataFilterLength, Number derivedFilterLength)
Description
segment data based on local extremas of function f(x,y)
Parameter Definition
Name |
Type |
Description |
x |
Number |
Number array x |
y |
Number |
Number array y |
dx |
Number |
step size for calculating the derivate |
dataFilterLength |
Number |
Filter length used in the low-pass filter to smooth the number array y. If the length is equal to 1, smoothing is skipped |
derivedFilterLength |
Number |
Filter length used in the low-pass filter to smooth the derivate. If the length is equal to 1, smoothing is skipped |
Example 1
| CREATE TABLE input(x int, y int);
INSERT INTO input VALUES (1,50), (2,200), (3,400), (4,50), (5,250), (6,300);
CREATE TABLE result AS PREPARE *, segmentByLocalExtrema(x, y, 1, 1, 1) as segment from input;
Table input = SELECT * FROM input;
TABLE result = SELECT * FROM result;
// input =
// +---------------+
// | input |
// +-------+-------+
// |x |y |
// |Integer|Integer|
// +-------+-------+
// |1 |50 |
// |2 |200 |
// |3 |400 |
// |4 |50 |
// |5 |250 |
// |6 |300 |
// +-------+-------+
//
// result =
// +-----------------------+
// | result |
// +-------+-------+-------+
// |x |y |segment|
// |Integer|Integer|Integer|
// +-------+-------+-------+
// |1 |50 |0 |
// |2 |200 |1 |
// |3 |400 |1 |
// |4 |50 |2 |
// |5 |250 |3 |
// |6 |300 |3 |
// +-------+-------+-------+
//
|