I am trying to determine the most dominant signal frequency. However, by artificially creating a 50 Hz signal and applying enough nulling to enhance the fft resolution, I get a maximum frequency of 49.997 Hz. For my application, this is a significant difference. Did I do something wrong here?
import numpy as np
import matplotlib.pyplot as plt
fs = 2**12
x = np.linspace(0,1,fs+1)
signal = np.sin(50*2*np.pi*x)
spect = abs(np.fft.fft(np.append(signal,np.zeros(999*fs))))
plt.figure('Four Coef')
plt.plot(spect)
plt.axis([49995,49999,2048.01,2048.05])
plt.show()
Please note that a factor of 49997 corresponds to a frequency of 49.997 Hz due to zero filling.
Editing: an array is exactly 1 second with a 50 Hz signal. The last 999 seconds are zeros to increase the fft resolution to 1 MHz. I have only 1 second of the available signal, from which I need a high frequency, accuracy to mHz
fs = 2**8 49.999, , ...