我有以毫秒(ms)(69300行)为单位的时间序列数据,我想应用低通,高通和带通Butterworth滤波器。
我的方法如下:
以下是我使用R创建的代码段:
# 69300 ms are 0.014430014430014Hz
x <- 1:69300
nyquist <- 0.014430014430014/2 # sampling rate/2
x1 <- sin(2*pi*RF*0.014430014430014) + 0.25*rnorm(length(RF))
# 0.014430014430014 Hz sinusoid+noise, RF is the time series metric
f_low <- 0.001443001/nyquist # 0.1 of total Hz divided by Nyquist
f_high <- 0.003607504/nyquist # 0.25 of total Hz divided by Nyquist
bf_low <- butter(4, f_low, type="low")
bf_high <- butter(4, f_high, type = "high")
bf_pass <- butter(4, 0.3000001, type = "pass") # f_high - f_low
b <- filter(bf_low, x1)
b1 <- filter(bf_high,x1)
b2 <- filter(bf_pass,x1)
这是正确的方法吗?应该使用正弦曲线+噪声代替过滤器应用于指标本身吗?