📄 filter_test.java
字号:
import java.io.*;
import wavelets.*;
import wavelet_util.*;
import dataInput.*;
/**
Apply the gaussian filter to a time series (in this case
the time series for Applied Materials (symbol: AMAT).
Two files will be generated: <i>filtered_data</i> which
contains the close price time series that has been
filtered using Haar wavelets and <i>filtered_data_noise</i>
which contains the noise spectrum.
*/
class filter_test {
public static void main( String[] args ) {
String timeSeriesFile = "amat_close"; // Applied Materials Close prices
tsRead data = new tsRead( timeSeriesFile );
//
// The wavelet algorithms work on arrays whose length is a power
// of two. Set the length to the nearest power of two that is
// less than or equal to the data length.
//
int len = data.getSize();
if (len > 0) {
int newSize = binary.nearestPower2( len );
data.setSize( newSize );
double[] vals = data.getArray();
if (vals != null) {
noise_filter filter = new noise_filter();
filter.filter_time_series( "filtered_data", vals );
}
}
}
} // filter_test
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -