diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2010-02-03 22:35:13 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2010-02-03 22:35:13 +0000 |
commit | 42b2b09b9146e7fd74233b9529c398fa11dd1ab1 (patch) | |
tree | 819c2a33e36305d7dd33f1e9061000414de40333 /examples | |
parent | 13302b75fdd89b5d7398381ff1bb62a9cd3599f7 (diff) | |
download | LibXtract-42b2b09b9146e7fd74233b9529c398fa11dd1ab1.tar.gz LibXtract-42b2b09b9146e7fd74233b9529c398fa11dd1ab1.tar.bz2 LibXtract-42b2b09b9146e7fd74233b9529c398fa11dd1ab1.zip |
- fixed DC/Nyquist inclusion bug in xtract_spectrum() and refactored a bit
Diffstat (limited to 'examples')
-rw-r--r-- | examples/simpletest/simpletest.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/examples/simpletest/simpletest.c b/examples/simpletest/simpletest.c index 3ead2d6..b17da16 100644 --- a/examples/simpletest/simpletest.c +++ b/examples/simpletest/simpletest.c @@ -23,12 +23,28 @@ int main(void) { - float mean = 0, vector[] = {1, 2, 3}; + float mean = 0, vector[] = {.1, .2, .3, .4, -.5, -.4, -.3, -.2, -.1}, + spectrum[10]; + int n, N = 9; + float argf[4]; + + argf[0] = 8000.f; + argf[1] = XTRACT_MAGNITUDE_SPECTRUM; + argf[2] = 0.f; + argf[3] = 0.f; - xtract[XTRACT_MEAN]((void *)&vector, 3, NULL, (void *)&mean); + xtract[XTRACT_MEAN]((void *)&vector, N, NULL, (void *)&mean); + xtract_init_fft(N, XTRACT_SPECTRUM); + xtract[XTRACT_SPECTRUM]((void *)&vector, N, &argf[0], (void *)&spectrum[0]); + + printf("\nThe mean of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = %.1f\n\n", mean); + printf("\nResults of xtract_spectrum():\n"); + + for(n = 0; n < N; n++){ + printf("%.3f\t", spectrum[n]); + } + printf("\n"); - printf("\nThe mean of [1, 2, 3] = %.1f\n\n", mean); - return 0; } |