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

Calculate amplitude and phase of a given harmonic #241

Open
escherstair opened this issue Mar 7, 2025 · 1 comment
Open

Calculate amplitude and phase of a given harmonic #241

escherstair opened this issue Mar 7, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@escherstair
Copy link

I can use Real FFT Functions to calculate the amplitude and phase of all the harmonics in the signal represented by the input buffer.
And this is ok.
But sometimes I need to calculate only one specific harmonic (known in advance) and so using the FFT Functions (of 4096 samples, as an example) to keep only one FFT line (amplitude + phase) is far for optmized.

Can I use some internal FFT function (calling it directly) to get this result (using the same twiddle tables already available for FFT)?
Or should I implement the calculation from scratch, with the formula below?
X = sum(x.*exp(-i*2*pi*k*[0:N-1]/N));
and then

amplitude = mag(X)
phase = arg(X)

Thanks

@christophe0606
Copy link
Contributor

@escherstair You need the Goertzel algorithm which is not provided by the library.

@christophe0606 christophe0606 added the enhancement New feature or request label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants