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

Add support of Frequencies on non-0 Nyquist Band to fftfreq? #41

Closed
N5N3 opened this issue Aug 14, 2020 · 4 comments
Closed

Add support of Frequencies on non-0 Nyquist Band to fftfreq? #41

N5N3 opened this issue Aug 14, 2020 · 4 comments

Comments

@N5N3
Copy link

N5N3 commented Aug 14, 2020

Now fftfreq only return the frequency axis on the 0th Nyquist Band by default.
Maybe we could add a argument, i.e. fc, to determine where the axis is, like:

fftfreq(10,1,0.3)
10-element Frequencies{Float64}:
  0.0
  0.1
  0.2
  0.3
  0.4
  0.5
  0.6
  0.7
 -0.2
 -0.1
@N5N3 N5N3 changed the title Add support of generate Frequencies on non-0 Nyquist Band to fftfreq? Add support of Frequencies on non-0 Nyquist Band to fftfreq? Aug 14, 2020
@stevengj
Copy link
Member

stevengj commented Aug 14, 2020

Since neither numpy nor matlab provide this option, it's not clear how much demand is there for this option?

Once you have signals whose bandwidth lies in some other range, I suspect we'll have to leave it up to the user to make their axis what they want — after all, the bandwidth does not even need to be contiguous.

@N5N3
Copy link
Author

N5N3 commented Aug 14, 2020

As fftfreq is used for fft outputs, if the signal was sampled under Nyquist Law, the appropriate frequency axis should be [fc-0.5fs,fc+0.5fs).

Anyway, we could use DUC/DDC to make fc equals to 0, and the option seems non-essential. But I thought it might be more “elegant”?

@stevengj
Copy link
Member

(There is also a multi-band version of Nyquist's law. Basically it just boils down to the bandwidth(s) not overlapping due to aliasing.)

I think that in the vast majority of cases where FFTs are used for sampled signals, the bandwidth has already been shifted to center it on zero. The fftfreq function has been around for decades (in Matlab, Numpy, …) and in all this time it doesn't seem like there has been much of a demand for arbitrary frequency center?

@N5N3
Copy link
Author

N5N3 commented Aug 14, 2020

In fact, there no official fftfreq in matlab, only a fileexchange inspired by numpy.

I add this issue because I need a struct like Frequencies to contraint a function's input, but Frequencies only support fc = 0.

Maybe i should define it myself.

@N5N3 N5N3 closed this as completed Aug 14, 2020
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

2 participants