频域分析
Conv
函数简介
本函数对两个输入序列进行卷积,即多项式乘法。
函数名: CONV
输入序列: 仅支持两个输入序列,类型均为 INT32 / INT64 / FLOAT / DOUBLE
输出序列: 输出单个序列,类型为DOUBLE,它是两个序列卷积的结果。序列的时间戳从0开始,仅用于表示顺序。
提示: 输入序列中的NaN
将被忽略。
使用示例
输入序列:
+-----------------------------+---------------+---------------+
| Time|root.test.d2.s1|root.test.d2.s2|
+-----------------------------+---------------+---------------+
|1970-01-01T08:00:00.000+08:00| 1.0| 7.0|
|1970-01-01T08:00:00.001+08:00| 0.0| 2.0|
|1970-01-01T08:00:00.002+08:00| 1.0| null|
+-----------------------------+---------------+---------------+
用于查询的SQL语句:
select conv(s1,s2) from root.test.d2
输出序列:
+-----------------------------+--------------------------------------+
| Time|conv(root.test.d2.s1, root.test.d2.s2)|
+-----------------------------+--------------------------------------+
|1970-01-01T08:00:00.000+08:00| 7.0|
|1970-01-01T08:00:00.001+08:00| 2.0|
|1970-01-01T08:00:00.002+08:00| 7.0|
|1970-01-01T08:00:00.003+08:00| 2.0|
+-----------------------------+--------------------------------------+
Deconv
函数简介
本函数对两个输入序列进行去卷积,即多项式除法运算。
函数名: DECONV
输入序列: 仅支持两个输入序列,类型均为 INT32 / INT64 / FLOAT / DOUBLE
参数:
result
:去卷积的结果,取值为'quotient'或'remainder',分别对应于去卷积的商和余数。在缺省情况下,输出去卷积的商。
输出序列: 输出单个序列,类型为DOUBLE。它是将第二个序列从第一个序列中去卷积(第一个序列除以第二个序列)的结果。序列的时间戳从0开始,仅用于表示顺序。
提示: 输入序列中的NaN
将被忽略。
使用示例
计算去卷积的商
当result
参数缺省或为'quotient'时,本函数计算去卷积的商。
输入序列:
+-----------------------------+---------------+---------------+
| Time|root.test.d2.s3|root.test.d2.s2|
+-----------------------------+---------------+---------------+
|1970-01-01T08:00:00.000+08:00| 8.0| 7.0|
|1970-01-01T08:00:00.001+08:00| 2.0| 2.0|
|1970-01-01T08:00:00.002+08:00| 7.0| null|
|1970-01-01T08:00:00.003+08:00| 2.0| null|
+-----------------------------+---------------+---------------+
用于查询的SQL语句:
select deconv(s3,s2) from root.test.d2
输出序列:
+-----------------------------+----------------------------------------+
| Time|deconv(root.test.d2.s3, root.test.d2.s2)|
+-----------------------------+----------------------------------------+
|1970-01-01T08:00:00.000+08:00| 1.0|
|1970-01-01T08:00:00.001+08:00| 0.0|
|1970-01-01T08:00:00.002+08:00| 1.0|
+-----------------------------+----------------------------------------+
计算去卷积的余数
当result
参数为'remainder'时,本函数计算去卷积的余数。输入序列同上,用于查询的SQL语句如下:
select deconv(s3,s2,'result'='remainder') from root.test.d2
输出序列:
+-----------------------------+--------------------------------------------------------------+
| Time|deconv(root.test.d2.s3, root.test.d2.s2, "result"="remainder")|
+-----------------------------+--------------------------------------------------------------+
|1970-01-01T08:00:00.000+08:00| 1.0|
|1970-01-01T08:00:00.001+08:00| 0.0|
|1970-01-01T08:00:00.002+08:00| 0.0|
|1970-01-01T08:00:00.003+08:00| 0.0|
+-----------------------------+--------------------------------------------------------------+
DWT
函数简介
本函数对输入序列进行一维离散小波变换。
函数名: DWT
输入序列: 仅支持单个输入序列,类型为 INT32 / INT64 / FLOAT / DOUBLE
参数:
method
:小波滤波的类型,提供'Haar', 'DB4', 'DB6', 'DB8',其中DB指代Daubechies。若不设置该参数,则用户需提供小波滤波的系数。不区分大小写。coef
:小波滤波的系数。若提供该参数,请使用英文逗号','分割各项,不添加空格或其它符号。layer
:进行变换的次数,最终输出的向量个数等同于 .默认取1。
输出序列: 输出单个序列,类型为DOUBLE,长度与输入相等。
提示: 输入序列长度必须为2的整数次幂。
使用示例
Haar变换
输入序列:
+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|1970-01-01T08:00:00.000+08:00| 0.0|
|1970-01-01T08:00:00.100+08:00| 0.2|
|1970-01-01T08:00:00.200+08:00| 1.5|
|1970-01-01T08:00:00.300+08:00| 1.2|
|1970-01-01T08:00:00.400+08:00| 0.6|
|1970-01-01T08:00:00.500+08:00| 1.7|
|1970-01-01T08:00:00.600+08:00| 0.8|
|1970-01-01T08:00:00.700+08:00| 2.0|
|1970-01-01T08:00:00.800+08:00| 2.5|
|1970-01-01T08:00:00.900+08:00| 2.1|
|1970-01-01T08:00:01.000+08:00| 0.0|
|1970-01-01T08:00:01.100+08:00| 2.0|
|1970-01-01T08:00:01.200+08:00| 1.8|
|1970-01-01T08:00:01.300+08:00| 1.2|
|1970-01-01T08:00:01.400+08:00| 1.0|
|1970-01-01T08:00:01.500+08:00| 1.6|
+-----------------------------+---------------+
用于查询的SQL语句:
select dwt(s1,"method"="haar") from root.test.d1
输出序列:
+-----------------------------+-------------------------------------+
| Time|dwt(root.test.d1.s1, "method"="haar")|
+-----------------------------+-------------------------------------+
|1970-01-01T08:00:00.000+08:00| 0.14142135834465192|
|1970-01-01T08:00:00.100+08:00| 1.909188342921157|
|1970-01-01T08:00:00.200+08:00| 1.6263456473052773|
|1970-01-01T08:00:00.300+08:00| 1.9798989957517026|
|1970-01-01T08:00:00.400+08:00| 3.252691126023161|
|1970-01-01T08:00:00.500+08:00| 1.414213562373095|
|1970-01-01T08:00:00.600+08:00| 2.1213203435596424|
|1970-01-01T08:00:00.700+08:00| 1.8384776479437628|
|1970-01-01T08:00:00.800+08:00| -0.14142135834465192|
|1970-01-01T08:00:00.900+08:00| 0.21213200063848547|
|1970-01-01T08:00:01.000+08:00| -0.7778174761639416|
|1970-01-01T08:00:01.100+08:00| -0.8485281289944873|
|1970-01-01T08:00:01.200+08:00| 0.2828427799095765|
|1970-01-01T08:00:01.300+08:00| -1.414213562373095|
|1970-01-01T08:00:01.400+08:00| 0.42426400127697095|
|1970-01-01T08:00:01.500+08:00| -0.42426408557066786|
+-----------------------------+-------------------------------------+
FFT
函数简介
本函数对输入序列进行快速傅里叶变换。
函数名: FFT
输入序列: 仅支持单个输入序列,类型为 INT32 / INT64 / FLOAT / DOUBLE
参数:
method
:傅里叶变换的类型,取值为'uniform'或'nonuniform',缺省情况下为'uniform'。当取值为'uniform'时,时间戳将被忽略,所有数据点都将被视作等距的,并应用等距快速傅里叶算法;当取值为'nonuniform'时,将根据时间戳应用非等距快速傅里叶算法(未实现)。result
:傅里叶变换的结果,取值为'real'、'imag'、'abs'或'angle',分别对应于变换结果的实部、虚部、模和幅角。在缺省情况下,输出变换的模。compress
:压缩参数,取值范围(0,1],是有损压缩时保留的能量比例。在缺省情况下,不进行压缩。
输出序列: 输出单个序列,类型为DOUBLE,长度与输入相等。序列的时间戳从0开始,仅用于表示顺序。
提示: 输入序列中的NaN
将被忽略。
使用示例
等距傅里叶变换
当type
参数缺省或为'uniform'时,本函数进行等距傅里叶变换。
输入序列:
+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|1970-01-01T08:00:00.000+08:00| 2.902113|
|1970-01-01T08:00:01.000+08:00| 1.1755705|
|1970-01-01T08:00:02.000+08:00| -2.1755705|
|1970-01-01T08:00:03.000+08:00| -1.9021131|
|1970-01-01T08:00:04.000+08:00| 1.0|
|1970-01-01T08:00:05.000+08:00| 1.9021131|
|1970-01-01T08:00:06.000+08:00| 0.1755705|
|1970-01-01T08:00:07.000+08:00| -1.1755705|
|1970-01-01T08:00:08.000+08:00| -0.902113|
|1970-01-01T08:00:09.000+08:00| 0.0|
|1970-01-01T08:00:10.000+08:00| 0.902113|
|1970-01-01T08:00:11.000+08:00| 1.1755705|
|1970-01-01T08:00:12.000+08:00| -0.1755705|
|1970-01-01T08:00:13.000+08:00| -1.9021131|
|1970-01-01T08:00:14.000+08:00| -1.0|
|1970-01-01T08:00:15.000+08:00| 1.9021131|
|1970-01-01T08:00:16.000+08:00| 2.1755705|
|1970-01-01T08:00:17.000+08:00| -1.1755705|
|1970-01-01T08:00:18.000+08:00| -2.902113|
|1970-01-01T08:00:19.000+08:00| 0.0|
+-----------------------------+---------------+
用于查询的SQL语句:
select fft(s1) from root.test.d1
输出序列:
+-----------------------------+----------------------+
| Time| fft(root.test.d1.s1)|
+-----------------------------+----------------------+
|1970-01-01T08:00:00.000+08:00| 0.0|
|1970-01-01T08:00:00.001+08:00| 1.2727111142703152E-8|
|1970-01-01T08:00:00.002+08:00| 2.385520799101839E-7|
|1970-01-01T08:00:00.003+08:00| 8.723291723972645E-8|
|1970-01-01T08:00:00.004+08:00| 19.999999960195904|
|1970-01-01T08:00:00.005+08:00| 9.999999850988388|
|1970-01-01T08:00:00.006+08:00| 3.2260694930700566E-7|
|1970-01-01T08:00:00.007+08:00| 8.723291605373329E-8|
|1970-01-01T08:00:00.008+08:00| 1.108657103979944E-7|
|1970-01-01T08:00:00.009+08:00| 1.2727110997246171E-8|
|1970-01-01T08:00:00.010+08:00|1.9852334701272664E-23|
|1970-01-01T08:00:00.011+08:00| 1.2727111194499847E-8|
|1970-01-01T08:00:00.012+08:00| 1.108657103979944E-7|
|1970-01-01T08:00:00.013+08:00| 8.723291785769131E-8|
|1970-01-01T08:00:00.014+08:00| 3.226069493070057E-7|
|1970-01-01T08:00:00.015+08:00| 9.999999850988388|
|1970-01-01T08:00:00.016+08:00| 19.999999960195904|
|1970-01-01T08:00:00.017+08:00| 8.723291747109068E-8|
|1970-01-01T08:00:00.018+08:00| 2.3855207991018386E-7|
|1970-01-01T08:00:00.019+08:00| 1.2727112069910878E-8|
+-----------------------------+----------------------+
注:输入序列服从
等距傅里叶变换并压缩
输入序列同上,用于查询的SQL语句如下:
select fft(s1, 'result'='real', 'compress'='0.99'), fft(s1, 'result'='imag','compress'='0.99') from root.test.d1
输出序列:
+-----------------------------+----------------------+----------------------+
| Time| fft(root.test.d1.s1,| fft(root.test.d1.s1,|
| | "result"="real",| "result"="imag",|
| | "compress"="0.99")| "compress"="0.99")|
+-----------------------------+----------------------+----------------------+
|1970-01-01T08:00:00.000+08:00| 0.0| 0.0|
|1970-01-01T08:00:00.001+08:00| -3.932894010461041E-9| 1.2104201863039066E-8|
|1970-01-01T08:00:00.002+08:00|-1.4021739447490164E-7| 1.9299268669082926E-7|
|1970-01-01T08:00:00.003+08:00| -7.057291240286645E-8| 5.127422242345858E-8|
|1970-01-01T08:00:00.004+08:00| 19.021130288047125| -6.180339875198807|
|1970-01-01T08:00:00.005+08:00| 9.999999850988388| 3.501852745067114E-16|
|1970-01-01T08:00:00.019+08:00| -3.932894898639461E-9|-1.2104202549376264E-8|
+-----------------------------+----------------------+----------------------+
注:基于傅里叶变换结果的共轭性质,压缩结果只保留前一半;根据给定的压缩参数,从低频到高频保留数据点,直到保留的能量比例超过该值;保留最后一个数据点以表示序列长度。
HighPass
函数简介
本函数对输入序列进行高通滤波,提取高于截止频率的分量。输入序列的时间戳将被忽略,所有数据点都将被视作等距的。
函数名: HIGHPASS
输入序列: 仅支持单个输入序列,类型为 INT32 / INT64 / FLOAT / DOUBLE
参数:
wpass
:归一化后的截止频率,取值为(0,1),不可缺省。
输出序列: 输出单个序列,类型为DOUBLE,它是滤波后的序列,长度与时间戳均与输入一致。
提示: 输入序列中的NaN
将被忽略。
使用示例
输入序列:
+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|1970-01-01T08:00:00.000+08:00| 2.902113|
|1970-01-01T08:00:01.000+08:00| 1.1755705|
|1970-01-01T08:00:02.000+08:00| -2.1755705|
|1970-01-01T08:00:03.000+08:00| -1.9021131|
|1970-01-01T08:00:04.000+08:00| 1.0|
|1970-01-01T08:00:05.000+08:00| 1.9021131|
|1970-01-01T08:00:06.000+08:00| 0.1755705|
|1970-01-01T08:00:07.000+08:00| -1.1755705|
|1970-01-01T08:00:08.000+08:00| -0.902113|
|1970-01-01T08:00:09.000+08:00| 0.0|
|1970-01-01T08:00:10.000+08:00| 0.902113|
|1970-01-01T08:00:11.000+08:00| 1.1755705|
|1970-01-01T08:00:12.000+08:00| -0.1755705|
|1970-01-01T08:00:13.000+08:00| -1.9021131|
|1970-01-01T08:00:14.000+08:00| -1.0|
|1970-01-01T08:00:15.000+08:00| 1.9021131|
|1970-01-01T08:00:16.000+08:00| 2.1755705|
|1970-01-01T08:00:17.000+08:00| -1.1755705|
|1970-01-01T08:00:18.000+08:00| -2.902113|
|1970-01-01T08:00:19.000+08:00| 0.0|
+-----------------------------+---------------+
用于查询的SQL语句:
select highpass(s1,'wpass'='0.45') from root.test.d1
输出序列:
+-----------------------------+-----------------------------------------+
| Time|highpass(root.test.d1.s1, "wpass"="0.45")|
+-----------------------------+-----------------------------------------+
|1970-01-01T08:00:00.000+08:00| 0.9999999534830373|
|1970-01-01T08:00:01.000+08:00| 1.7462829277628608E-8|
|1970-01-01T08:00:02.000+08:00| -0.9999999593178128|
|1970-01-01T08:00:03.000+08:00| -4.1115269056426626E-8|
|1970-01-01T08:00:04.000+08:00| 0.9999999925494194|
|1970-01-01T08:00:05.000+08:00| 3.328126513330016E-8|
|1970-01-01T08:00:06.000+08:00| -1.0000000183304454|
|1970-01-01T08:00:07.000+08:00| 6.260191433311374E-10|
|1970-01-01T08:00:08.000+08:00| 1.0000000018134796|
|1970-01-01T08:00:09.000+08:00| -3.097210911744423E-17|
|1970-01-01T08:00:10.000+08:00| -1.0000000018134794|
|1970-01-01T08:00:11.000+08:00| -6.260191627862097E-10|
|1970-01-01T08:00:12.000+08:00| 1.0000000183304454|
|1970-01-01T08:00:13.000+08:00| -3.328126501424346E-8|
|1970-01-01T08:00:14.000+08:00| -0.9999999925494196|
|1970-01-01T08:00:15.000+08:00| 4.111526915498874E-8|
|1970-01-01T08:00:16.000+08:00| 0.9999999593178128|
|1970-01-01T08:00:17.000+08:00| -1.7462829341296528E-8|
|1970-01-01T08:00:18.000+08:00| -0.9999999534830369|
|1970-01-01T08:00:19.000+08:00| -1.035237222742873E-16|
+-----------------------------+-----------------------------------------+
注:输入序列服从
IFFT
函数简介
本函数将输入的两个序列作为实部和虚部视作一个复数,进行逆快速傅里叶变换,并输出结果的实部。输入数据的格式参见FFT
函数的输出,并支持以FFT
函数压缩后的输出作为本函数的输入。
函数名: IFFT
输入序列: 仅支持两个输入序列,类型均为 INT32 / INT64 / FLOAT / DOUBLE
参数:
start
:输出序列的起始时刻,是一个格式为'yyyy-MM-dd HH:mm:ss'的时间字符串。在缺省情况下,为'1970-01-01 08:00:00'。interval
:输出序列的时间间隔,是一个有单位的正数。目前支持五种单位,分别是'ms'(毫秒)、's'(秒)、'm'(分钟)、'h'(小时)和'd'(天)。在缺省情况下,为1s。
输出序列: 输出单个序列,类型为DOUBLE。该序列是一个等距时间序列,它的值是将两个输入序列依次作为实部和虚部进行逆快速傅里叶变换的结果。
提示: 如果某行数据中包含空值或NaN
,该行数据将会被忽略。
使用示例
输入序列:
+-----------------------------+----------------------+----------------------+
| Time| root.test.d1.re| root.test.d1.im|
+-----------------------------+----------------------+----------------------+
|1970-01-01T08:00:00.000+08:00| 0.0| 0.0|
|1970-01-01T08:00:00.001+08:00| -3.932894010461041E-9| 1.2104201863039066E-8|
|1970-01-01T08:00:00.002+08:00|-1.4021739447490164E-7| 1.9299268669082926E-7|
|1970-01-01T08:00:00.003+08:00| -7.057291240286645E-8| 5.127422242345858E-8|
|1970-01-01T08:00:00.004+08:00| 19.021130288047125| -6.180339875198807|
|1970-01-01T08:00:00.005+08:00| 9.999999850988388| 3.501852745067114E-16|
|1970-01-01T08:00:00.019+08:00| -3.932894898639461E-9|-1.2104202549376264E-8|
+-----------------------------+----------------------+----------------------+
用于查询的SQL语句:
select ifft(re, im, 'interval'='1m', 'start'='2021-01-01 00:00:00') from root.test.d1
输出序列:
+-----------------------------+-------------------------------------------------------+
| Time|ifft(root.test.d1.re, root.test.d1.im, "interval"="1m",|
| | "start"="2021-01-01 00:00:00")|
+-----------------------------+-------------------------------------------------------+
|2021-01-01T00:00:00.000+08:00| 2.902112992431231|
|2021-01-01T00:01:00.000+08:00| 1.1755704705132448|
|2021-01-01T00:02:00.000+08:00| -2.175570513757101|
|2021-01-01T00:03:00.000+08:00| -1.9021130389094498|
|2021-01-01T00:04:00.000+08:00| 0.9999999925494194|
|2021-01-01T00:05:00.000+08:00| 1.902113046743454|
|2021-01-01T00:06:00.000+08:00| 0.17557053610884188|
|2021-01-01T00:07:00.000+08:00| -1.1755704886020932|
|2021-01-01T00:08:00.000+08:00| -0.9021130371347148|
|2021-01-01T00:09:00.000+08:00| 3.552713678800501E-16|
|2021-01-01T00:10:00.000+08:00| 0.9021130371347154|
|2021-01-01T00:11:00.000+08:00| 1.1755704886020932|
|2021-01-01T00:12:00.000+08:00| -0.17557053610884144|
|2021-01-01T00:13:00.000+08:00| -1.902113046743454|
|2021-01-01T00:14:00.000+08:00| -0.9999999925494196|
|2021-01-01T00:15:00.000+08:00| 1.9021130389094498|
|2021-01-01T00:16:00.000+08:00| 2.1755705137571004|
|2021-01-01T00:17:00.000+08:00| -1.1755704705132448|
|2021-01-01T00:18:00.000+08:00| -2.902112992431231|
|2021-01-01T00:19:00.000+08:00| -3.552713678800501E-16|
+-----------------------------+-------------------------------------------------------+
LowPass
函数简介
本函数对输入序列进行低通滤波,提取低于截止频率的分量。输入序列的时间戳将被忽略,所有数据点都将被视作等距的。
函数名: LOWPASS
输入序列: 仅支持单个输入序列,类型为 INT32 / INT64 / FLOAT / DOUBLE
参数:
wpass
:归一化后的截止频率,取值为(0,1),不可缺省。
输出序列: 输出单个序列,类型为DOUBLE,它是滤波后的序列,长度与时间戳均与输入一致。
提示: 输入序列中的NaN
将被忽略。
使用示例
输入序列:
+-----------------------------+---------------+
| Time|root.test.d1.s1|
+-----------------------------+---------------+
|1970-01-01T08:00:00.000+08:00| 2.902113|
|1970-01-01T08:00:01.000+08:00| 1.1755705|
|1970-01-01T08:00:02.000+08:00| -2.1755705|
|1970-01-01T08:00:03.000+08:00| -1.9021131|
|1970-01-01T08:00:04.000+08:00| 1.0|
|1970-01-01T08:00:05.000+08:00| 1.9021131|
|1970-01-01T08:00:06.000+08:00| 0.1755705|
|1970-01-01T08:00:07.000+08:00| -1.1755705|
|1970-01-01T08:00:08.000+08:00| -0.902113|
|1970-01-01T08:00:09.000+08:00| 0.0|
|1970-01-01T08:00:10.000+08:00| 0.902113|
|1970-01-01T08:00:11.000+08:00| 1.1755705|
|1970-01-01T08:00:12.000+08:00| -0.1755705|
|1970-01-01T08:00:13.000+08:00| -1.9021131|
|1970-01-01T08:00:14.000+08:00| -1.0|
|1970-01-01T08:00:15.000+08:00| 1.9021131|
|1970-01-01T08:00:16.000+08:00| 2.1755705|
|1970-01-01T08:00:17.000+08:00| -1.1755705|
|1970-01-01T08:00:18.000+08:00| -2.902113|
|1970-01-01T08:00:19.000+08:00| 0.0|
+-----------------------------+---------------+
用于查询的SQL语句:
select lowpass(s1,'wpass'='0.45') from root.test.d1
输出序列:
+-----------------------------+----------------------------------------+
| Time|lowpass(root.test.d1.s1, "wpass"="0.45")|
+-----------------------------+----------------------------------------+
|1970-01-01T08:00:00.000+08:00| 1.9021130073323922|
|1970-01-01T08:00:01.000+08:00| 1.1755704705132448|
|1970-01-01T08:00:02.000+08:00| -1.1755705286582614|
|1970-01-01T08:00:03.000+08:00| -1.9021130389094498|
|1970-01-01T08:00:04.000+08:00| 7.450580419288145E-9|
|1970-01-01T08:00:05.000+08:00| 1.902113046743454|
|1970-01-01T08:00:06.000+08:00| 1.1755705212076808|
|1970-01-01T08:00:07.000+08:00| -1.1755704886020932|
|1970-01-01T08:00:08.000+08:00| -1.9021130222335536|
|1970-01-01T08:00:09.000+08:00| 3.552713678800501E-16|
|1970-01-01T08:00:10.000+08:00| 1.9021130222335536|
|1970-01-01T08:00:11.000+08:00| 1.1755704886020932|
|1970-01-01T08:00:12.000+08:00| -1.1755705212076801|
|1970-01-01T08:00:13.000+08:00| -1.902113046743454|
|1970-01-01T08:00:14.000+08:00| -7.45058112983088E-9|
|1970-01-01T08:00:15.000+08:00| 1.9021130389094498|
|1970-01-01T08:00:16.000+08:00| 1.1755705286582616|
|1970-01-01T08:00:17.000+08:00| -1.1755704705132448|
|1970-01-01T08:00:18.000+08:00| -1.9021130073323924|
|1970-01-01T08:00:19.000+08:00| -2.664535259100376E-16|
+-----------------------------+----------------------------------------+
注:输入序列服从