# Calculating frequency bin

#### ivyivyivy

Joined Jan 9, 2017
4
I have time series with 72 terms and frequency 1/12 (1 cycle/12 months) and it is explained here that the frequency bin for positive frequency is 72/12+1 (+1 is because of MATLAB's syntax). But on the other side there is formula where frequency bin is k=fs/N, where N is length of time series (72 in my case) and fs is frequency (1/12 in my case). When I use this formula I get 1/(72*12), which is different from the upper 72/12, what is my mistake here?

#### MrChips

Joined Oct 2, 2009
27,641
You are taking 12 samples each year. Hence your frequency is 12 samples/year.

#### ivyivyivy

Joined Jan 9, 2017
4
You are taking 12 samples each year. Hence your frequency is 12 samples/year.
But is it then 12/72, if it is 12 samples each year?

#### MrChips

Joined Oct 2, 2009
27,641
Your record length = 72 samples, i.e. N/fs = 72/12 years
Your frequency spectrum bin = 1/(record length) = fs/N = 12/72 samples/year

#### ivyivyivy

Joined Jan 9, 2017
4
May I ask you is that mistake in tutorial? There is that positive frequency bin is 72/12, what is diferent from frequency spectrym bin which you wrote. I can't find what is mistake, but I see that something is different and unreachable for me.

#### MrChips

Joined Oct 2, 2009
27,641
I don't know what the tutorial did. I have not looked at it in detail.
The first point is 0 frequency.
The next bin is 12/72 = 0.16666... samples/year
Your Nyquist frequency = fs/2 = 6 samples/year
Hence the last bin would be (6 - 1/6) = 35/6 = 5.8333...