summaryrefslogtreecommitdiffstats
path: root/test/fractal_chaos_oscillator.c
blob: 921c194896458a5bfbf66c0cc7857c0a49d0b0aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <math.h>
#include <stddef.h>
#include "ts.h"

bool ts_test_fractal_chaos_oscillator( void )
{
    fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 };
    fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
    fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
    fp_t const cp[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };

    fp_t const * const x[] = { o, h, l, cp };

    /* k=3, half_k=1, offset=1, y_n=11 (i=1..10, y[11]=0) */
    fp_t const e[] = { 21.739130, 20.833333, 19.607843, 18.348624, 17.167382, 16.096579, 15.137181, 14.279340, 13.510661, 12.819229, 0.000000 };
    fp_t const * const exp[1] = { e };

    uint_t k = 3;
    return ts_test(ts_fractal_chaos_oscillator, ts_fractal_chaos_oscillator_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_fractal_chaos_oscillator_p);
}