Skip to content

Frequency resolution of f_hat #17

Description

@UDEPWollny

Hi,

I have a question regarding the frequency resolution for the vector of Fourier coefficients.
No matter what I do, whether I use equal M and N, or one being a multiple of the other, it doe's not change the frequency resolution of the coefficients given in f_hat. For equidistant FFT, there is is a relationship for df, which is the reciprocal of M * dt. This obviously does not apply here, since df stays always at df = 1 Hz.
Is there a chance to change this behavior, or am I doing something wrong in principle?
Here is my little test to check the right frequencies and amplitudes. I can see that the 200 Hz, for example, is always at index 200.

import numpy as np
import nfft as nf

n = 2**13
dt = 1.0e-4

x = np.linspace(0.0, n*dt, n)
y = 2. * np.sin(2. * np.pi * 2.5 * x) + 0.5 * np.sin(2. * np.pi * 50. * x) + 1.25 * np.sin(2. * np.pi * 200. * x)

f_hat = nf.nfft_adjoint(x, y, n)

import matplotlib.pyplot as plt
plt.plot(2.0/n * np.abs(f_hat[n//2:]))

plt.grid()
plt.xlim(195, 205)

plt.savefig('test.png')

THX!
Patrick

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions