Fast Fourier Transform Javascript

人走茶凉 提交于 2019-12-25 06:32:48

问题


I need a FFT function like the FFT in numpy (python) that takes only ONE list( length doesnt necessarily need to be power of 2).

I used dsp.js but it needs the Buffer size and buffer size must be power of 2 but my data length is 500.

is there any library that isnt audio exclusive ? or should I add 0 to end of array ?


回答1:


You absolutely can pad with zeros to reach the desired size. See this reference: http://www.bitweenie.com/listings/fft-zero-padding/

A quote straight from the article:

There are a few reasons why you might want to zero pad time-domain data. The most common reason is to make a waveform have a power-of-two number of samples. When the time-domain length of a waveform is a power of two, radix-2 FFT algorithms, which are extremely efficient, can be used to speed up processing time. FFT algorithms made for FPGAs also typically only work on lengths of power two.




回答2:


In addition to the options presented in the blog post suggested by SleuthEye, there is another Discrete Fourier Transform, which happens to be written in JavaScript. The output format may be different than what you'd get from other programs (e.g., MATLAB, MathCAD, etc.), but it is easy enough to edit by copying into, say, an Excel spreadsheet and re-formatting or scaling the results into the format you want.

And, as you'd like, this program does not require the number of inputs to be a power of 2.



来源:https://stackoverflow.com/questions/38316538/fast-fourier-transform-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!