Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaky PSD when using sampling rate that is not a power of 2 #37

Open
jdpigeon opened this issue Apr 26, 2018 · 0 comments
Open

Leaky PSD when using sampling rate that is not a power of 2 #37

jdpigeon opened this issue Apr 26, 2018 · 0 comments

Comments

@jdpigeon
Copy link

Just noticed this when debugging problems that arose when moving from an EEG device sampling at 256hz to one at 1000hz.

It seems that the PSD returned by

const fft = new FFT(bins, samplingRate);
        fft.forward(samples);
        return Array.from(fft.spectrum);

Is wrong when the sampling rate of the signal is not a power of 2 (e.g. 256, 1024). With a sampling rate of 1000hz I'm getting PSDs that are far too "leaky" and spread out to represent my test.

I actually don't notice any change in the PSD output at all when I change the samplingRate parameter, which makes me think that the implementation might just be inferring sampling rate from the number of bins? It would explain why it only works when my signal's sampling rate is equal to the number of bins in the FFT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant