Question 1
If you apply it over the entire length of the array, the length of the FFT would be the length of the array. But, the FFT is more efficient if the length is a power of two, so it is common to pad 0's onto the end of the signal until its length is a power of 2.
Overly simple example...
x = [3.4, 2.56, 1.3]
x
has a length of 3, the next power of 2 after 3 is 4, so we change x
to be
x = [3.4, 2.56, 1.3, 0]
and apply an FFT with length 4.
Another big BUT! If your signal is long, it becomes extremely inefficient to do the whole thing at once. You would not want to try to do an FFT on an audio file the length of even a short song. In that case, we break the signal into chunks of some reasonable size, perform an FFT on each, and average the results.
Odds are good that what you actually want to do with your data is a not just a standard FFT, but rather the averaging process I described above. Google Bartlett and Welch methods for more details.
Question 2
I'm not 100% sure what you're asking about here. I'm going to interpret it as you wanting know how the width of the frequency bins are determined and run with that.
The width of each frequency bin is determines solely by the rate the signal was sampled at and the length of the FFT. The width of each bin is the sampling frequency divided by the number of samples in your FFT.
df = fs / N
Frequency bins start from -fs/2
and go up to fs/2
.
That means if sampled at 100Hz for 100 samples, your frequency bins will be width 1 Hz. If you take 200 samples, you will now have 2x as many frequency bins and their width will be 1/2Hz each.
Step further:
Say 'Dur' is the signal duration in time domain,
Then the signal size would be:
N = Dur * fs
df = fs / N
df = fs / (Dur * fs)
df = 1 / Dur
This proves that frequency bin for FFT only depends on duration of the signal input. However, you can pad zeros onto/truncate the signal to make the frequency bin size you wish.