I am new in this community. So excuse me if it seems easy.
I want to calculate the amplitude of a specific frequency in a signal.
The frequency precision is (relevant question)
$$
df = \frac{fs}{NP}
$$
$$ fs=1/dt$$
NP is the number of points in the signal time seri.
The index of the frequency in the signal is
$$
ind = \frac{f}{df}
$$
the length of power spectrum array of signal is length(pxx) = NP/2-1
Example 1: for small frequencies
frequency = 1.0/128.0
dt=0.4
df = 0.001
NP = fs/df=2500
index of the signal = 8
lenght of pxx is 1249 so no problem.
Example 2: for large frequencies
freq = 2.0
dt=0.4
NP = fs/df=2500
index of the signal = 2000
The index of the frequency is larger than the number of points in pxx. If I double the number of points in the signal, the frequency precision halves and the index of frequency also doubles. Is there a frequency limit or I am doing something wrong?
Thanks for any guide.