1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_schaff_trend_cycle( void )
{
/* period=3, offset=52, y_n=48 */
fp_t x[100] = {
100.000000, 104.932803, 109.469637, 113.249904, 115.980586, 117.462425, 117.607714, 116.448140,
114.131948, 110.910698, 107.116800, 103.133815, 99.362193, 96.183508, 93.926363, 92.837048,
93.057531, 94.612780, 97.408533, 101.239717, 105.808768, 110.752209, 115.673120, 120.176596,
123.905018, 126.570000, 127.978150, 128.048347, 126.818984, 124.444538, 121.181777, 117.366816,
113.385098, 109.636962, 106.501880, 104.304564, 103.285957, 103.581711, 105.210072, 108.070246,
111.951406, 116.551523, 121.504346, 126.412117, 130.881103, 134.556766, 137.155435, 138.489641,
138.484867, 137.186202, 134.754318, 131.451109, 127.616305, 123.637121, 119.913670, 116.823220,
114.686494, 113.739025, 114.110109, 115.811263, 118.735191, 122.665371, 127.295395, 132.256340,
137.149724, 141.583098, 145.205106, 147.736868, 148.996894, 148.917291, 147.549835, 145.061339,
141.718757, 137.865336, 133.889954, 130.192382, 127.147579, 125.072189, 124.196267, 124.642717,
126.416325, 129.403321, 133.381551, 138.040314, 143.008121, 147.885875, 152.282525, 155.849995,
158.314276, 159.499906, 159.345639, 157.909919, 155.365657, 151.984789, 148.113982, 144.143665,
140.473160, 137.475006, 135.461681, 134.657694
};
fp_t const * const inp[1] = { x };
fp_t const e0[] = {
0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 100.000000, 100.000000, 100.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 100.000000,
100.000000, 100.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000
};
fp_t const e1[] = {
0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
0.000000, 0.000000, 33.333333, 55.555556, 70.370370, 46.913580, 31.275720, 20.850480,
13.900320, 9.266880, 6.177920, 4.118613, 2.745742, 1.830495, 1.220330, 0.813553,
0.542369, 0.361579, 0.241053, 0.160702, 0.107135, 0.071423, 0.047615, 33.365077,
55.576718, 70.384479, 46.922986, 31.281991, 20.854660, 13.903107, 9.268738, 6.179159,
4.119439, 2.746293, 1.830862, 1.220575, 0.813716, 0.542478, 0.361652, 0.241101
};
fp_t const * const exp[2] = { e0, e1 };
uint_t period = 3;
return ts_test(ts_schaff_trend_cycle, ts_schaff_trend_cycle_offset, inp, exp, 100, (ts_constant_t *)&period, &ts_schaff_trend_cycle_p);
}
|