# Frequency bin of the positive and negative frequency

I am using this MATLAB tutorial for Frequency-Domain Linear Regression. There is one part of code they provide, where it is necessary to determine the "frequency bin of the positive and negative frequency", for fft and ifft:

freqbin = 72/12;
freqbins = [freqbin 72-freqbin]+1;
tsfit = zeros(72,1);
tsfit(freqbins) = tsdft(freqbins);
tsfit = ifft(tsfit);
mu = mean(ts);
tsfit = mu+tsfit;


Length of time series is $72$, and $12$ months is considered as one cycle.

• How can there be only one frequency bin for positive frequency?
• How do we know that it is exactly $72/12 + 1$ ($+1$ is because first bin is for zero frequency)? Is this some formula or what?

In the tutorial it is stated that

Because the frequencies are spaced at 1/72 and the first bin corresponds to 0 frequency, the correct bin is 72/12+1. This is the frequency bin of the positive frequency. You must also include the frequency bin corresponding to the negative frequency: -1 cycle/12 months. With MATLAB indexing, the frequency bin of the negative frequency is 72-72/12+1.

• The bin number is not any weird formula or anything. You have data for every month, but in the tutorial they are looking for cycles per year. You have 6 years. So $72/12 =6$ and that's where it comes from. (As you said, the $+1$ comes from the fact that there is a bin corresponding to the mean value.)