/*This is a signal sum of 800 hz and 3.2 khz sine waves which sampled in 10khz and 32 of this samples are create a data array. In this example spectrum of the signal showed using fft */ #include "simpleDSP_fft.h" #define DATA_LEN 64 double data_magnitude[DATA_LEN]; COMPLEX data[DATA_LEN] = { 450.527388478791, 0.0, -101.597194769693, 0.0, 1031.37368065794, 0.0, -613.160606150798, 0.0, -1618.03398874990, 0.0, -115.808021270615, 0.0, -866.985966358939, 0.0, -1567.20047563694, 0.0, 541.587312835687, 0.0, 618.033988749895, 0.0, -263.146073893067, 0.0, 1504.40995610763, 0.0, 1504.40995610763, 0.0, -263.146073893067, 0.0, 618.033988749894, 0.0, 541.587312835686, 0.0, -1567.20047563694, 0.0, -866.985966358938, 0.0, -115.808021270616, 0.0, -1618.03398874989, 0.0, -613.160606150796, 0.0, 1031.37368065794, 0.0, -101.597194769693, 0.0, 450.527388478786, 0.0, 2000, 0.0, 450.527388478790, 0.0, -101.597194769691, 0.0, 1031.37368065794, 0.0, -613.160606150791, 0.0, -1618.03398874990, 0.0, -115.808021270614, 0.0, -866.985966358941, 0.0, -1567.20047563694, 0.0, 541.587312835695, 0.0, 618.033988749887, 0.0, -263.146073893066, 0.0, 1504.40995610763, 0.0, 1504.40995610762, 0.0, -263.146073893069, 0.0, 618.033988749893, 0.0, 541.587312835687, 0.0, -1567.20047563694, 0.0, -866.985966358946, 0.0, -115.808021270611, 0.0, -1618.03398874989, 0.0, -613.160606150798, 0.0, 1031.37368065794, 0.0, -101.597194769688, 0.0, 450.527388478784, 0.0, 2000, 0.0, 450.527388478792, 0.0, -101.597194769692, 0.0, 1031.37368065794, 0.0, -613.160606150806, 0.0, -1618.03398874989, 0.0, -115.808021270608, 0.0, -866.985966358952, 0.0, -1567.20047563695, 0.0, 541.587312835680, 0.0, 618.033988749898, 0.0, -263.146073893067, 0.0, 1504.40995610763, 0.0, 1504.40995610762, 0.0, -263.146073893068, 0.0, }; long startTime; long calcTime; void setup() { Serial.begin(9600); startTime = millis(); FFT(data, DATA_LEN); calcTime = millis() - startTime; Serial.print("Total calculation time: "); Serial.println(calcTime); for (int i = 0; i < DATA_LEN; i++) { Serial.println(abs(data[i].real)); } } void loop() { // put your main code here, to run repeatedly: }