A227 of 29
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

A2 · Lesson 27 · Lab: adding sinusoids

Turning a pile of sine waves into one

A three-phase motor, an array of antennas and every AC circuit you'll analyze have the same job at their core: add up several sine waves of one frequency. The last two lessons did it by hand with arrows. In this lab you'll teach Python to do it: convert between rectangular and polar form, add any number of sinusoids, and then check the result the slow way by adding the waves sample by sample. If you haven't started A4 yet, its lessons on functions, loops and lists (lessons 1 to 9) cover the Python used here.

  • Two sinusoids of the same frequency, drawn as arrows: A∠φ and B∠θ. The third arrow is their sum, drawn tip to tail.
  • Change the lengths and angles. The sum's length and angle are the amplitude and phase of the combined wave.
  • Find two settings where the sum is shorter than either arrow on its own.

Predict

Three sine waves of amplitude 10 at 0°, 120° and 240° are added. What is the amplitude of the sum?

Name it

Rectangular and polar form in Python

A sinusoid Acos⁡(ωt+φ) is the arrow A∠φ. Its components are

x=Acos⁡φ,y=Asin⁡φ

and going back, A=x2+y2 and φ is the angle of (x,y). Python's math.atan2(y, x) returns that angle in radians in the right quadrant, from −180° to 180°, which a plain math.atan(y / x) can't do (it can't tell (1,1) from (−1,−1)).

Adding sinusoids

Sinusoids of the same frequency add as their arrows do:

  1. convert each to components;
  2. add all the x parts and all the y parts;
  3. convert the totals back to polar form.

Checking by samples

The arrow method claims that ∑kAkcos⁡(θ+φk)=Acos⁡(θ+φ) for every θ. A computer can test the claim directly: evaluate both sides at many angles and find the largest difference. If the method is right, that difference is only rounding error, around 10−15 times the size of the numbers.

Worked example

Add 3cos⁡ωt and 4cos⁡(ωt+90°).

Show the solution
  1. Components. 3∠0° is (3,0) and 4∠90° is (0,4).
  2. Add. The sum is (3,4), of length 5 and angle arctan⁡(4/3)=53.13° So the sum is 5cos⁡(ωt+53.13°).
  3. Check at ωt = 0. The left side is 3+4cos⁡90°=3, and the right side is 5cos⁡53.13°=3.

Answer the sum is 5cos⁡(ωt+53.13°).

Worked example

The three phase currents of a slightly unbalanced load have amplitudes 10, 10 and 12 A, at 0°, −120° and 120°. What current flows in the neutral wire?

Show the solution
  1. Add the x components. x=10+10cos⁡(−120°)+12cos⁡120°=10−5−6=−1
  2. Add the y components. y=10sin⁡(−120°)+12sin⁡120°=−8.660+10.392=1.732
  3. Back to polar. The sum is (−1,1.732), of length 2 at 120°.
  4. Read the result. The neutral carries 2 A at 120°, the same as the extra 2 A in the third phase: the three balanced 10 A currents cancel and only the excess remains.

Answer 2 A flows in the neutral, at 120°.

Worked example

Two antennas pick up the same 1 mV signal, 150° out of phase. What does a receiver that adds them get?

Show the solution
  1. Components. Add 1∠0° and 1∠150°: (1+cos⁡150°,sin⁡150°)=(0.134,0.5)
  2. Back to polar. r=0.1342+0.52=0.518mVθ=arctan⁡(0.5/0.134)=75° The sum is weaker than either antenna alone.
  3. The general rule. Equal arrows always add to 2cos⁡(δ/2) times one of them, pointing halfway between them. Here that's 2cos⁡75°=0.518
  4. Where it's used. Phased-array antennas use exactly this to cancel signals from some directions and reinforce others.

Answer the receiver gets 0.518 mV at 75°, weaker than either antenna alone.

Check

Two sinusoids of amplitude 5 are 30° apart. What is the amplitude of their sum?

Check

What angle does math.atan2(y, x) give, in degrees, for the point (−1,−4)?

Check

Write to_rect(A, deg), returning the components (x, y) of the arrow A∠deg, and to_polar(x, y), returning (A, deg) with the angle from math.atan2 in degrees.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write add_sinusoids(waves). waves is a list of (A, deg) pairs, each standing for Acos⁡(ωt+deg), all at the same frequency. Return the single (A, deg) that equals their sum. You can use your functions from the last task, or write the components out again.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Write max_difference(waves, A, deg). It evaluates ∑kAkcos⁡(θ+φk) and Acos⁡(θ+φ) at 3600 angles θ spread over a full turn (0°, 0.1°, 0.2°, ...) and returns the largest absolute difference between them. The test uses it to confirm add_sinusoids, and to show that a wrong answer is caught.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why can sinusoids of the same frequency be added as arrows, but sinusoids of different frequencies can't?

Practice

Keep practicing

4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.