Bird
Raised Fist0
Power Electronicsknowledge~5 mins

Total Harmonic Distortion (THD) in Power Electronics - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: Total Harmonic Distortion (THD)
O(n)
Understanding Time Complexity

When calculating Total Harmonic Distortion (THD), we want to know how the work needed grows as we include more harmonics.

We ask: How does the calculation time increase when we analyze more harmonic frequencies?

Scenario Under Consideration

Analyze the time complexity of the following code snippet.


// Calculate THD by summing squares of harmonic amplitudes
function calculateTHD(harmonics) {
  let sumSquares = 0;
  for (let i = 1; i < harmonics.length; i++) {
    sumSquares += harmonics[i] * harmonics[i];
  }
  return Math.sqrt(sumSquares) / harmonics[0];
}
    

This code calculates THD by looping through all harmonic amplitudes except the fundamental, summing their squares, then dividing by the fundamental amplitude.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Looping through the harmonic amplitudes array once.
  • How many times: Exactly once for each harmonic beyond the first (fundamental).
How Execution Grows With Input

As the number of harmonics increases, the number of operations grows directly with it.

Input Size (n)Approx. Operations
109 additions and multiplications
10099 additions and multiplications
1000999 additions and multiplications

Pattern observation: The work grows in a straight line as more harmonics are added.

Final Time Complexity

Time Complexity: O(n)

This means the time to calculate THD increases proportionally with the number of harmonics analyzed.

Common Mistake

[X] Wrong: "Calculating THD takes the same time no matter how many harmonics we include."

[OK] Correct: Each additional harmonic adds more calculations, so the time grows with the number of harmonics.

Interview Connect

Understanding how calculation time grows with input size shows you can analyze and explain performance, a useful skill in many technical discussions.

Self-Check

"What if we only calculated THD using every other harmonic? How would the time complexity change?"

Practice

(1/5)
1. What does Total Harmonic Distortion (THD) measure in an electrical signal?
easy
A. The total voltage of the main signal only
B. The amount of unwanted harmonic frequencies compared to the main signal
C. The frequency of the main signal
D. The power consumption of the device

Solution

  1. Step 1: Understand the definition of THD

    THD measures how much extra unwanted signals (harmonics) are present compared to the main signal.
  2. Step 2: Compare options with the definition

    Only the option describing the amount of unwanted harmonic frequencies compared to the main signal matches the definition of THD.
  3. Final Answer:

    The amount of unwanted harmonic frequencies compared to the main signal -> Option B
  4. Quick Check:

    THD = unwanted harmonics / main signal [OK]
Hint: THD shows extra unwanted signals vs main signal [OK]
Common Mistakes:
  • Confusing THD with total voltage
  • Thinking THD measures frequency only
  • Mixing THD with power consumption
2. Which formula correctly represents Total Harmonic Distortion (THD)?
easy
A. THD = V1 x (V2 + V3 + ... + Vn)
B. THD = V1 / (V2 + V3 + ... + Vn)
C. THD = V1 + V2 + V3 + ... + Vn
D. THD = √(V2² + V3² + ... + Vn²) / V1

Solution

  1. Step 1: Recall the THD formula

    THD is calculated as the square root of the sum of squares of harmonic voltages divided by the fundamental voltage (V1).
  2. Step 2: Match formula to options

    THD = √(V2² + V3² + ... + Vn²) / V1 matches the correct formula: THD = √(V2² + V3² + ... + Vn²) / V1.
  3. Final Answer:

    THD = √(V2² + V3² + ... + Vn²) / V1 -> Option D
  4. Quick Check:

    THD formula uses root sum squares over fundamental [OK]
Hint: THD = root sum squares of harmonics over main voltage [OK]
Common Mistakes:
  • Using addition instead of root sum squares
  • Dividing fundamental by harmonics instead of reverse
  • Multiplying voltages instead of dividing
3. Given harmonic voltages V2 = 3V, V3 = 4V, and fundamental voltage V1 = 10V, what is the THD value?
medium
A. 0.5
B. 0.25
C. 0.7
D. 0.1

Solution

  1. Step 1: Calculate root sum squares of harmonics

    √(3² + 4²) = √(9 + 16) = √25 = 5 volts.
  2. Step 2: Divide by fundamental voltage

    THD = 5 / 10 = 0.5.
  3. Final Answer:

    0.5 -> Option A
  4. Quick Check:

    THD = 5/10 = 0.5 [OK]
Hint: Use Pythagoras for harmonics, then divide by main voltage [OK]
Common Mistakes:
  • Adding harmonic voltages instead of root sum squares
  • Dividing fundamental by harmonics
  • Mixing up voltage values
4. A student calculates THD using THD = (V2 + V3 + ... + Vn) / V1 instead of the correct formula. What is the main error?
medium
A. They calculated THD correctly
B. They used the fundamental voltage incorrectly
C. They forgot to square the harmonic voltages before summing
D. They used the wrong units for voltage

Solution

  1. Step 1: Identify the correct THD calculation method

    THD requires squaring each harmonic voltage, summing, then taking the square root before dividing by fundamental voltage.
  2. Step 2: Analyze the student's formula

    The student summed harmonic voltages directly without squaring, which underestimates the distortion.
  3. Final Answer:

    They forgot to square the harmonic voltages before summing -> Option C
  4. Quick Check:

    THD needs squares of harmonics, not simple sums [OK]
Hint: Always square harmonics before summing for THD [OK]
Common Mistakes:
  • Summing harmonics directly without squares
  • Ignoring square root step
  • Mixing voltage units
5. If a power system has a fundamental voltage of 120V and harmonic voltages of 12V, 9V, and 5V, what is the approximate THD percentage? (Use THD = √(V2² + V3² + V4²) / V1 x 100%)
hard
A. 13.5%
B. 10.5%
C. 15.0%
D. 20.0%

Solution

  1. Step 1: Calculate root sum squares of harmonic voltages

    √(12² + 9² + 5²) = √(144 + 81 + 25) = √250 ≈ 15.81 volts.
  2. Step 2: Calculate THD percentage

    THD = (15.81 / 120) x 100% ≈ 13.18%.
  3. Step 3: Choose closest option

    13.5% is the closest approximate value among the options.
  4. Final Answer:

    13.5% -> Option A
  5. Quick Check:

    THD ≈ 13.2% closest to 13.5% [OK]
Hint: Calculate root sum squares, divide by fundamental, multiply by 100% [OK]
Common Mistakes:
  • Forgetting to multiply by 100 for percentage
  • Adding harmonics instead of root sum squares
  • Rounding errors without checking options
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard