diff --git a/test/test-fft.js b/test/test-fft.js new file mode 100644 index 0000000..bc42bca --- /dev/null +++ b/test/test-fft.js @@ -0,0 +1,15 @@ +var FFT = numerics.fft; + +var signal = [1,0,1,0]; +var phasors = FFT.fft(signal); + +log(phasors); + +var frequencies = FFT.fftFreq(phasors, 8000), // Sample rate and coef is just used for length, and frequency step + magnitudes = FFT.fftMag(phasors); +var both = frequencies.map(function (f, ix) { + return {frequency: f, magnitude: magnitudes[ix]}; + }); + +log(inspect(both)); +