# Calculating amplitude, time-shift and phase of third sinusoid as a sum of two others

My apologies in advance, I am new to this digital signal processing. Question is at the bottom

I have two 4000hz sinusoids given by the following formulas: unknown frequency such that: $$x_1(t) = 24\cos(2\pi4000(t-t_{m1})) \\ x_2(t) = 28.8 \cos(2\pi4000(t-t_{m2}))$$ and a third given by $$x_3(t) = x_1(t) + x_2(t)$$ where $$t_{m1} = 0.000775 \\ t_{m2} = -0.00258$$

I have calculated the phase of the first two sinusoids (in radians) as $$\phi_1 = 0.329 \\ \phi_2 = -1.132$$ with the formula $$\phi_i = \omega_if_i$$ where $$\omega_i = 2\pi f$$

Finally, I need to calculate the amplitude $$A_3$$ and phase $$\phi_3$$ of $$x_3(t)$$. I am unsure which formula to use to do so. I believe $$A_3$$ is calculated as: $$a_3 = \sqrt{A_1^2 + A_2^2} = 37.49$$

How would I calculate the time shift and phase angle of $$x_3(t)$$?

• Are you familiar with complex numbers ? – Hilmar Sep 27 '19 at 18:38
• @hilmar I am, but not with respect to this topic. – kp-a Sep 27 '19 at 20:34

Here's how I would do it.

Use the Cosine angle addition formula on $$x_1$$ and $$x_2$$:

$$\cos( \alpha + \beta) = \cos( \alpha ) \cos(\beta)-\sin( \alpha ) \sin(\beta)$$

Like this:

$$x_1(t) = a_1 \cos( \omega t + \phi_1 )$$

$$x_1 = a_1 \cos( \omega t ) \cos(\phi_1)- a_1 \sin( \omega t ) \sin(\phi_1)$$

The $$\omega$$s will be the same, so:

$$x_2 = a_2 \cos( \omega t ) \cos(\phi_2)- a_2 \sin( \omega t ) \sin(\phi_2)$$

You can now rearrange and add them together:

\begin{align} x_3 &= x_1 + x_2 \\ &= \left[a_1 \cos(\phi_1) + a_2 \cos(\phi_2) \right] \cos( \omega t ) - \left[a_1 \sin(\phi_1) + a_2 \sin(\phi_2) \right] \sin( \omega t ) \end{align}

Since you know the $$\phi$$s and $$a$$s, you can put this in the form:

$$x_3 = C \cos( \omega t ) - D \sin( \omega t )$$

Now, you just have to reverse the process to get it back into time phase form.

$$\theta = \operatorname{atan2}(D,C)$$

$$M = \sqrt{ C^2 + D^2 }$$

Therefore:

$$x_3 = M \cos( \omega t + \theta )$$

$$x_3 = M \cos\left( \omega \left( t + \frac{\theta}{\omega} \right) \right)$$

Now, just plug and chug and you should have it.

The latter part might be better understood in a different order:

\begin{align} x_3(t) &= a_3 \cos( \omega t + \phi_3 )\\ &= a_3 \cos( \omega t ) \cos(\phi_3)- a_3 \sin( \omega t ) \sin(\phi_3) \end{align}

From the equations above:

\begin{align} C &= a_3 \cos(\phi_3)\\ D &= a_3 \sin(\phi_3) \end{align}

From there it follows:

$$a_3 = \sqrt{C^2+D^2}$$

and

$$\phi_3 = \tan^{-1}\left(\frac{D}{C}\right)$$

The thing is, both of these last two equations have two possible solutions each and they need to be matched. Conveniently, the atan2 function is available on most platforms which yields the correct angle from the latter for the positive root of the former.

This solution is actually the proof of a very important principle: When two pure tones of the same frequency are added together the result is a pure tone of the same frequency although it is possible for it to have zero amplitude.

In order for the zero amplitude case to occur, the two tones have to have the same amplitude and be a half cycle ($$\pi$$ radians, 180 degrees) out of phase. This is called complete destructive interference.

If the two tones are in phase, the amplitudes are merely added and the phase remains the same. This is technically called complete constructive interference.

By repeated application of this principle, the same holds true for any linear combination of tones.

This shows up in a surprising number of places.

a. Perhaps the discussion at: https://www.dsprelated.com/showarticle/635.php would be of some value to you.

• You beat me to it, I remember reading this article a few years ago! – Ben Sep 28 '19 at 16:49
• Welcome back to this forum. Looking forward to seeing what you have to say in the next item in your answer (the one that will begin "b.") when you get around to adding it. – Dilip Sarwate Sep 28 '19 at 17:03
• Hi Dilip. (Hope you are doing well.) I don't know what you mean by "the next item in your answer (the one that will begin "b.")." – Richard Lyons Oct 2 '19 at 10:49
• @DilipSarwate, Hey Rick, you want to start your comment as I did if you want the little notification thingy to work. Your post begins: "a. Perhaps..". I, too, have been breathlessly awaiting what might be the "b." – Cedron Dawg Oct 2 '19 at 18:15
• @CedronDog, Hi Cedron. Ah, ...now I see. I don't remember typing the two 'a.' characters in my Answer. So my eyes didn't actually see them in my Answer. Thanks for helping me. In any case Mbaz can obtain his desired results by using the top row of Table 1 in my blog at my above posted web link, or he can use your equations. Happily, your and my equations produce identical results. – Richard Lyons Oct 3 '19 at 10:34