Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
parent
6d5ccb91b9
commit
df36b1d3d6
15
test/test-fft.js
Normal file
15
test/test-fft.js
Normal file
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user