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: and . 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?
It's zero. The three arrows, drawn tip to tail, close into an equilateral triangle and end where they started. That's why a balanced three-phase load needs no return current: the neutral wire carries the sum of the three currents, and it's zero. If one current is a little bigger, the neutral carries the difference.
Name it
Rectangular and polar form in Python
A sinusoid is the arrow . Its components are
and going back, and is the angle of . Python's math.atan2(y, x) returns that angle in radians in the right quadrant, from to , which a plain math.atan(y / x) can't do (it can't tell from ).
Adding sinusoids
Sinusoids of the same frequency add as their arrows do:
- convert each to components;
- add all the parts and all the parts;
- convert the totals back to polar form.
Checking by samples
The arrow method claims that 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 times the size of the numbers.
Worked example
Add and .
Show the solution
- Components. is and is .
- Add. The sum is , of length 5 and angle So the sum is .
- Check at ωt = 0. The left side is , and the right side is .
Answer the sum is .
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
- Add the x components.
- Add the y components.
- Back to polar. The sum is , of length 2 at 120°.
- 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
- Components. Add and :
- Back to polar. The sum is weaker than either antenna alone.
- The general rule. Equal arrows always add to times one of them, pointing halfway between them. Here that's
- 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 ?
Check
Write to_rect(A, deg), returning the components (x, y) of the arrow 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 , 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 and 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?
Each sinusoid is the horizontal shadow of an arrow of length turning at the rate , starting at angle . When every arrow turns at the same rate, they keep the same angles between them forever, so the whole picture just rotates as one rigid shape. The sum of the shadows is then the shadow of the sum of the arrows, and that sum is itself a fixed-length arrow turning at : a single sinusoid of the same frequency. If the frequencies differ, the arrows turn at different rates, their relative angles keep changing, and their sum changes length over time. That's the beating you hear from two close tones, and no single fixed arrow can describe it.
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.