When we have FFT of Square wave of a pure real signal with high frequency(close to f(max), less than half of sampling frequency) we see only 2 symmetric high peaks but when we decrease the frequency we see the two peaks and peaks of harmonics and they are getting smaller and smaller, why? Also the highest peaks are getting away from each other, movig <- and -> , vice versa -> <- when we increase the frequency. why?
FFT of Sin wave has only 2 peaks no matter what and they also get away from each other when the frequency is low and get more and more closer when the frequency gets higher. Why? I would be glad if you can enlighten me!
Lets say our sample count is 64 and sampling frequency is 8kHz and signal frequency 2kHz. We should see 2 peaks one at 16 and one at 48.
The picture above is only the left half of my graph, there is also a symmetrical part on the right. My signal is pure real. These small harmonics dont appear at my above settings but when I decrease the freuency to 600 Hz for example I see harmonics like this for square wave and none for Sine Wave. So on high frequencies they disappear and low frequencies they appear, the lower the more of these harmonics. Also the peaks are getting away from each other when I lower the frequency and getting closer when I increase the frequency. At 4 kHz I expect to see only 1 Peak, two of them will unite. Why? Also I couldnt test what happens if I run with 5kHz :( and when I run the code with lots of samples like 2048, the graph displayed makes no sense at all. Why?
I know I'm asking a lot questions but I would be glad if you have some time and help me!
Answer
By definition, a sine wave is given by: $\frac{e^{j2\pi f_0 n} - e^{-j2\pi f_0 n}}{2}$. Therefore, you will see one harmonics at index $k_1 = N\frac{f_0}{F_s}$ and a copy of it at $k_2 = N - k_1$. Where $N$ is the FFT size which is 64 in your case. So, $k_1 = 64.2k/8k = 16$, and $k_2 = 48$.
Similarly, you need to find the definition of a square wave, which must be having the main component $e^{j2\pi f_0 n}$ and its harmonics $e^{j2\pi k f_0 n}$, where $k = 0, 1, 2, ...$.
For high frequencies, there are lesser Harmonics as by definition Harmonic frequencies are always the integer multiple of the fundamental frequency. Therefore, if your fundamental is at $600$Hz, you'll have Harmonics at $1200, 1800, 2400, ...$. Now as you increase your fundamental, the Harmonics become fewer and fewer.
There is more to it in terms of aliasing, however, I'll not dwell into that topic.
No comments:
Post a Comment