# Power supply Harmonics calculation using FFT

I am trying to calculate harmonics of power supply with using a FFT. My sampling rate is 400 samples/sec. This means 8 samples per cycle. I am not getting sensible answers and think that I am making a mistake as I am getting harmonics power more than my signal power.

The input of my FFT is

• 0
• 222
• 325
• 222
• 0
• -222
• -325
• -222

at 2.5 ms spacing. The output of my FFT is:

## 2 Answers

Leaving aside the mismatch in power, for a minute:

Your sampling rate is 400 Hz.

Assuming you live in a 50 Hz country, the frequencies you are interested in are the 5th harmonic at 250 Hz, the 7th harmonic at 350Hz, and so on.

Your sampling rate is not fast enough. Your sampling rate must be at least twice the frequency of the highest frequency signal you are interested in.

As an example, if you want to detect up to the 19th harmonic (1,950 Hz) your sampling frequency must be at least 3,900 Hz.

Fix that, then try your calculations again and see if you get sensible results.

• Thanks I was misinterpreting as my sampling frequency should be double to my fundamental frequency,.. – ABHISHEK PARIKH Nov 25 '15 at 7:48
• So can't I do this using 8 point FFT? Is it compulsory to use 16 point fft? Thanks – ABHISHEK PARIKH Nov 26 '15 at 9:01
• What 8 points were you going to use for an 8-point FFT? You need to do an FFT over at least one 50Hz cycle (20msec). So if you are sampling at 10 kHz you will need to do a 200-point FFT. – Li-aung Yip Nov 26 '15 at 9:06
• I am getting 39.59798 - 1317.508801j as fundamental and 39.59798 - 17.508801j at 3rd harmonic what should be my THD? @Li-aung Yip – ABHISHEK PARIKH Aug 9 '16 at 10:36
• I don't think there is enough space in the comments field to adequately help you solve your detailed calculation problem. – Li-aung Yip Aug 9 '16 at 12:17

An 8 point FFT does not produce useful results in the second half of it's output - all of the frequencies above 200 Hz are just a mirror image of the frequencies below it. This is a fundamental property of the discrete Fourier transform.

With that in mind, there are only 2 frequencies that show any signal here: 50 Hz and 150 Hz. The 50 Hz amplitude is much larger than the 150 Hz amplitude. We can't say anything about the other harmonics, since we have no information on them. You'll need a lot more samples to say that

I am getting harmonics power more than my signal power.

because we simply can't see the other harmonics here. (See Li-aung Yip's answer for more info.)

• I am getting 39.59798 - 1317.508801j as fundamental and 39.59798 - 17.508801j at 3rd harmonic what should be my THD? @Greg d'Eon – ABHISHEK PARIKH Aug 9 '16 at 10:36