How to get the real frequency from an FFT output graph?

1.9k Views Asked by At

I am working in Origin 7.0 and trying to understand how the FFT Analysis works. In an attempt to understand, I decided to run a test of the program using known frequencies.

The function I used was: 2*sin(5*t) + cos(10*t)
Where t is a list of integers from 1 - 45.

So the frequency input was the list of integers, and the real input was the output of the trigonometric function. The sampling interval used was 1.

The output that I got is as follows: FFT output

Somehow, the 45 points that I gave it were turned into 64 points. Additionally, the peaks are at 0.203125 and 0.40625, which are not at 5 and 10.

How do I interpret these graphs to actually get the true frequency? aka: What is the formula to connect these discrete frequencies to the true frequency?

Please do not give me a computer code to do this. I would like to be able to do this by hand or in the graphing program Origin itself.

2

There are 2 best solutions below

0
On

The Fast Fourier Transform is at its Fastest when the number of points is a power of 2. So it pads your series with a string of 19 zeros until it reaches 64 points.

It looks for sequences of the form $A(f)\exp(i[2\pi fn+\theta(f)])$. So the frequency $f$ for $\sin 5t$ is $f=5/(2\pi)$. If you change $f$ by an integer, you get the same sequence because $\exp(i2\pi)=1$. So it only looks for $f$ between -1/2 and 1/2. If you give it a real sequence, then the amplitude $A(f)=A(-f)$, That's why it only gives the plot between f=0 and f=1/2.

Your $0.203125$ is actually $1-5/(2\pi)$, and the other one is $2-10/(2\pi)$.

0
On

1)Did you scale your function up so that the variation was shown in the integers? Something like $f(t)=20000 \sin (5t)+10000 \cos (10t)$? That would be a good idea if you are using integer input.
2)The simplest FFTs are for a number of points that is a power of $2$. It appears Origin padded your data with zeros. It will be easier to interpret if you use a power of $2$ for your number of points
3)Your function is assumed to be periodic with the period of your data. If you are going to use $64$ points, it would be good to fit your sine waves to be complete periods in that many points. So try $f(x)=20000 \sin (\frac {10\pi t}{64})+10000 \cos (\frac{20 \pi t}{64})$ The discontinuity from the zero padding is making things harder to interpret
4)Finally to your question: the period of $\sin (5t)$ is $\frac 5{2\pi}\approx 0.796$ sec. You need to sample at least twice per cycle. Otherwise the data will be aliased to a lower frequency than you expect. You need to make your sampling period less than $0.2$ sec to capture $\cos (10t)$ or else to use lower frequencies.