Data Science and Computing with Python for Pilots and Flight Test Engineers
Single Sine/Cosine with Phase from Sine and Cosine
In our analytic solutions, we will often encounter sums of sine and cosine, such as
$$ A e^{\sigma t}\sin(\omega_d t) + B e^{\sigma t}\cos(\omega_d t), $$
where \(A\) and \(B\) are arbitrary amplitudes.
It may be desirable to rewrite such a solution as a single sine or cosine and a phase \(\phi\), i.e. either as
$$ C \sin(\omega_d t + \phi)$$
or as
$$ C \cos(\omega_d t + \phi)$$
with a suitable phase \(\phi\) and amplitude \(C\). Note that the amplitude \(C\) of the single sine or cosine will generally be different from either amplitude \(A\) or \(B\) of the original functions.
The formulas to get this accomplished are the following:
$$ A \sin(\alpha) + B \cos(\alpha) = \sqrt{A^2 + B^2} \sin \left(\alpha + \arctan\left(\frac{B}{A}\right)\right) $$
if \(A>0\), or
$$ A \sin(\alpha) + B \cos(\alpha) = \sqrt{A^2 + B^2} \cos \left(\alpha – \arctan\left(\frac{A}{B}\right)\right) $$
if \(B>0\).