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
ENH: Perform FFT over a signal as if it was centered around zero #23478
Comments
The FFT is pretty strictly defined as starting at 0, but I can see the case for making it easier to have functions symmetric around 0. This is not all that different from wanting spectra with the middle instead of the start at 0, which one can do with
Rather than have a new argument, maybe the easiest would be to explicitly mention the use of |
Your example is a nice one but:
What I suggest is like this:
This will work for any len(a) and any fft_len. Try another symmetric function and see. For example:
|
Proposed new feature or change:
In the FFT algorithm, the first sample is considered to be at t=0.
This means that even that ALL the vectors that will go inside are asymmetric. Therefore, all the answers will be complex.
This is mathmatically true, but when you learn for example the FFT of a rect function (lets say, np.ones(N)), you "expect" to get a sinc function (which is Real only) but you get a complex answer. Again, this is because the FFT is done on signal that STARTS from zero, and is not symmetric around zero effectivly.
If you could insert a flag that can make you do an FFT as if the signal was symmetric around zero (t=-n/2 to t=n/2) and cancel this insertion of phase.
https://www.linkedin.com/posts/ido-kazma-596310174_signalprocessing-fft-numpy-activity-6922788016688103424-4PPe?utm_source=share&utm_medium=member_desktop
The text was updated successfully, but these errors were encountered: