EDIT A more elegant and general answer from Matt L.
The same result through brute-force trigonometry follows.
- Use the identity $\cos(\alpha - \beta) = \cos(\alpha)\cos(\beta) + \sin(\alpha)\sin(\beta)$
- Re-arrange your result, you should then be able to
- use the identity $a\cos(x) + b\sin(x) = c\cos(x+\phi)$
$c = \text{sign}(a)\sqrt{a^2+b^2}$
$\phi = \arctan\left(-\frac{b}{a}\right) \quad\text{if} \ a\neq0$
EDIT: ResultsResults
\begin{align} A &= \sqrt{(1+0.7\cos(56*0.4))^2 + (0.7\sin(56*0.4))^2}\\ B &= \text{arctan}\left(-\frac{0.7\sin(56*0.4)}{1+0.7\cos(56*0.4)}\right)\\ \omega &= 56 \end{align}
w = 56;
a = 1+0.7*cos(w *0.4);
b = 0.7*sin(w *0.4);
A = sqrt(a^2+b^2); % Matt L: abs(1+0.7*exp(-1i*0.4*w))
B = atan(-b/a); % Matt L: angle(1+0.7*exp(-1i*0.4*w))
t = (0:100);
y = cos(w*t) + 0.7*cos(w*(t-0.4));
y2 = A*cos(w*t + B);
figure(1)
subplot 211
hold on
plot(y)
plot(y2)
legend('y', 'y2')
grid on
subplot 212
plot(y-y2);
title('error')
grid on