# How to separate a specific frequency signal from a summation of a few signals?

I want to calculate THD. SO how do I isolate the fundamental frequency from a signal with harmonics? I have a signal V which is a sum of V1, V2 and V3. V1=A1sin(w1t+phi1), V2=A2sin(w2t+phi2) and V3=A3sin(w3t+phi3). I want to find out the magnitude/amplitude of a known frequency w1 in the signal. How do I proceed? Should I use the FFT library? If yes then how?

• Though this is not really Arduino specific: Yes, I think you need to do an FFT on the signal. When googling something like "Arduino FFT" you get for example this library. It also has examples. You can use it, or program the FFT yourself. That would be a pure C/C++ programming question. – chrisl Nov 27 '20 at 10:17
• What are the values of the frequencies ω₁/2π...? To what precision are they known? Are they constant? How long does the signal last? Is it steady enough to allow you to measure V₁, V₂ and V₃ sequentially, rather than simultaneously? To what precision do you need the THD measurement? – Edgar Bonet Nov 27 '20 at 14:12
• @chrisl: He may not need an FFT. The FFT computes the amplitude of many frequencies. If the OP only needs three frequencies, the FFT is most likely overkill. – Edgar Bonet Nov 27 '20 at 14:15