I have a real signal $f(t) $that is periodic on $[0,L]$ where $L=1$. I sampled it uniformly $64$ times and computed FFT (in python). I was asked to find the frequency where the transformed signal is having the largest magnitude. I found the index $i$ of the largest value in the transformed signal.
How do I find the frequency (in hertz ) corespondent to the index $i$ ? My thinking is that my frequency domain must be $64$ uniform samples on $[-32/L,31/L]=[-32,31]$ and therefore the central frequency is $$f=i-32$$.
To support my claim I run the following code to get the frequency domain:
import numpy as np
num_samples = 64
L=1
freqs = np.fft.fftfreq(num_samples, L/num_samples)
print(np.fft.fftshift(freqs))
which yields:
[-32 ,-31 ,-30 ,-29 ,-28 ,-27, -26 ,-25 ,-24, -23 ,-22 ,-21, -20 ,-19 -18 ,-17 ,-16 ,-15 ,-14 ,-13 ,-12 ,-11, -10 , -9 , -8 ,-7 , -6 , -5 -4 , -3 ,-2 ,-1 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 10 , 11 , 12 , 13 , 14 , 15 , 16 ,17 ,18 , 19 , 20 , 21 , 22 , 23 24 , 25 ,26 ,27 , 28 , 29 , 30 , 31]
However my answer was not accepted by the TA. They claimed that the frequency domain is $64$ uniform samples on $[-\pi*32,\pi*31]$ and my answer is wrong.
Who is right ?
Edit March-15-2024 - made it clear we are looking for the frequency that maximizes the transformed signal.
You are correct, assuming that frequency is measured in Hertz.
Suppose $N$ is even for simplicity, and there is a collection of samples $g_0,...,g_{N-1}$. If $n \mapsto \hat{g}_n$ is the DFT, then we can write $g_k = \sum_{n=-{N \over 2}}^{{N \over 2}-1} \hat{g}_ne^{i2 \pi {n k \over N}}$.
In the case given $g_k = f(k {L \over N} )$, so letting $t=k {L \over N} $, we have $f(t) = \sum_{n=-{N \over 2}}^{{N \over 2}-1} \hat{g}_ne^{i2 \pi {n kL \over N L}} = \sum_{n=-{N \over 2}}^{{N \over 2}-1} \hat{g}_ne^{i2 \pi {n \over L}t}$. Hence the frequencies are ${n \over L}$ with $n = -{N \over 2},...,{N \over 2}-1$, and so the frequency of largest magnitude occurs are $n=-{N \over 2}$ and is $f_\max=-{N \over 2L}$.
In your example, $N=64, L=1$ and so $f_\max = 32$.