# Calculating phase shift between two sines of equal, unknown, amplitude and frequency

I've got a source signal $$s_1(t)$$ and a system affecting that, yielding a phase-shifted version $$s_2(t)$$;

\begin{align} \color{blue}{s_1(t)} &= A\sin(t+\phi_1)\\ \color{red}{s_2(t)} &= A\sin(t+\phi_2)\\ \end{align}

The amplitude $$A$$ is unknown. How many samples (sampling happens periodically) would I need to verify that $$\phi_1-\phi_2 = \frac32\pi$$?

As a practical example, given these 2 points on each curve: on the purple curve, the original signal:

• point A (231,3.533151)
• point B: (230,3.614015)

and on the the filtered signal: the red curve:

• point C (231,1.398873)
• point D (230,1.174265)

How would you confirm the phase shift of $$\frac32\pi$$, given an equal -unknown- amplitude and equal -unknown- frequency of the 2 signals? Is a numerical solution possible for online, causal analysis? Or do you need 3 points on each curve? Thank you.

• could you cut out the fantasyland cruft? You've got a mathematical question, please don't blow it up through acting backstory makes it better. – Marcus Müller Feb 15 '20 at 0:45
• also, I think you mean the output of the filter, not the filter itself. – Marcus Müller Feb 15 '20 at 0:46
• (I don't mean to be harsh, but what we do in math is abstract all day. There's no difference between the harsh realm of reality and fantasyland to us: The rules of math apply to both.) – Marcus Müller Feb 15 '20 at 0:56
• Would it be possible to clarify the question a bit? My perception at least is that it provides a setup that undermines the question. What is so special about $\frac{3 \pi}{2}$ ? Do you mean that the filter should have unity gain? – A_A Feb 15 '20 at 8:57
• @A_A I tried to keep the original question intact but to boil it down. – Marcus Müller Feb 15 '20 at 10:44

Two samples is sufficient and we can determine if the phase difference is indeed $$\frac{3\pi}{2}$$ as follows:

Start with the hypothesis that the phase difference $$\phi_1-\phi_2$$ is $$\frac{3\pi}{2}$$, which is equivalent to $$-\frac{\pi}{2}$$

If and only if the phase is in such quadrature, then $$s_1(t)$$ and $$s_2(t)$$ will be the real and imaginary components of a single vector on the unit circle with radius A which can be given as $$-jAe^{j(t+\phi_1)} = As_1(t) + jAs_2(t)$$. This starts at the angle $$\phi_1-\pi/2$$ when t = 0 and rotates counter-clock-wise with increasing t, which matches the plot shown with the purple line representing the real axis and the red line representing the imaginary.

Starting from a position on the unit circle at time = $$t_1$$ with position given by the real and imaginary components $$s_1(t_1)$$ and $$s_2(t_1)$$, we can move forward in time to $$t_2$$ over a determined angle which should predict $$s_1(t_2)$$ and $$s_2(t_2)$$. If this prediction matches the given result, then this will confirm the hypothesis:

The starting angle using the first sample as given by B and D is given by $$tan^{-1}(s_1(t_1)/s_2(t_1))$$ $$= tan^{-1}(3.614015/1.174265) = 1.256637$$ radians.

The change is angle to the second sample is simply the difference in time since the frequency unit is 1 radian/sec given by $$sin(t)$$:

$$\Delta\phi = t_2-t_1 = 231-230 = 1$$ radian (NOTE! This alone clearly does not match the plot visually, so the numbers given cannot be actually derived from the plot! There must be a frequency factor multiplied by t in the actual formulas for this to match the plot).

Therefore if the phase difference was $$-\frac{\pi}{2}$$ then the second angle would be at $$1.256637 + 1$$ radian or $$2.256637$$ radians and the ratio of $$(s_1(t_2)/s_2(t_2))$$ would be $$\tan(2.256637)= -1.22195$$

This does not match the ratio for the second sample given by A and C and therefore the phase difference cannot be $$\frac{3\pi}{2}$$ for the formulas as given.

You've got a system of equations with 2 unknowns ($$A$$ and the phase offsets). You hence need two equations. That means two samples.

• No equations are known in this hypothetical scenario. – MisterH Feb 15 '20 at 0:58
• sampling gives you an equation every time you sample. – Marcus Müller Feb 15 '20 at 0:59
• If the given is that the input and output are pure sinusoids then you have your equations as knowns. – hotpaw2 Feb 15 '20 at 2:14
• @MarcusMüller Two equations with two unknowns can (often, but not always!) be solved when the equations are linear. It might be worth it to show that two equations still suffice when they are not linear? – MBaz Feb 16 '20 at 17:38
• @MarcusMüller Sorry about the semantics. Given these 2 points on each curve: on the purple curve: (230,3.614015), (231,3.533151), and on the red curve: (230,1.174265), (231,1.398873). How would you confirm the given phase shift, given equal -unknown- amplitude and equal -unknown- frequency of the 2 signals? Is a numerical solution possible? – MisterH Feb 19 '20 at 22:35