From 690c0712062a3c3ef6881ae3fb9954f730f93035 Mon Sep 17 00:00:00 2001 From: Enrique Condes Date: Mon, 28 Aug 2017 13:48:02 -0500 Subject: [PATCH] Fix to issues #6 and #7. Cleaning imaginary to avoid OVF. --- Examples/FFT_01/FFT_01.ino | 1 + Examples/FFT_03/FFT_03.ino | 1 + library.properties | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples/FFT_01/FFT_01.ino b/Examples/FFT_01/FFT_01.ino index 2404cd4..154bcdd 100644 --- a/Examples/FFT_01/FFT_01.ino +++ b/Examples/FFT_01/FFT_01.ino @@ -63,6 +63,7 @@ void loop() { vReal[i] = int8_t((amplitude * (sin((i * (twoPi * cycles)) / samples))) / 2.0);/* Build data with positive and negative values*/ //vReal[i] = uint8_t((amplitude * (sin((i * (twoPi * cycles)) / samples) + 1.0)) / 2.0);/* Build data displaced on the Y axis to include only positive values*/ + vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows } /* Print the results of the simulated sampling according to time */ Serial.println("Data:"); diff --git a/Examples/FFT_03/FFT_03.ino b/Examples/FFT_03/FFT_03.ino index ffa6171..e52712d 100644 --- a/Examples/FFT_03/FFT_03.ino +++ b/Examples/FFT_03/FFT_03.ino @@ -56,6 +56,7 @@ void loop() for(uint16_t i =0;i maintainer=Enrique Condes sentence=A library for implementing Fast Fourier Transform on Arduino.