Calculating frequency bin

Thread Starter

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 confusing your units.
Your x scale is years.
You are taking 12 samples each year. Hence your frequency is 12 samples/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
 

Thread Starter

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...
 

Thread Starter

ivyivyivy

Joined Jan 9, 2017
4
Thanks on all answers. This is part of the tutorial which is of interest in this question and there is formulation that frequency bin is 72/12 and i still can't understand relation beetwen your answer and tutorial:

Determine the frequency bin in the discrete Fourier transform that corresponds to 1 cycle/12 months. 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.
 
Top