Skip to main content
added 174 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31

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}

enter image description here

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
  • 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: Results

\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}

enter image description here

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

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$

Results

\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}

enter image description here

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
added 10 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
  • 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: Results

\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}

enter image description here

w = 56;
a = 1+0.7*cos(56*0w *0.4); 
b = 0.7*sin(56*0w *0.4);

A = sqrt(a^2+b^2); % orMatt L: abs(1+0.7*exp(-1i*0.4*564*w))
B = atan(-b/a); % orMatt L: angle(1+0.7*exp(-1i*0.4*564*w))

t = (0:100);
y = cos(56*tw*t) + 0.7*cos(56*w*(t-0.4));
y2 = A*cos(56*tw*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
  • 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: Results

\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}

enter image description here

a = 1+0.7*cos(56*0.4); 
b = 0.7*sin(56*0.4);

A = sqrt(a^2+b^2); % or abs(1+0.7*exp(-1i*0.4*56))
B = atan(-b/a); % or angle(1+0.7*exp(-1i*0.4*56))

t = (0:100);
y = cos(56*t) + 0.7*cos(56*(t-0.4));
y2 = A*cos(56*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
  • 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: Results

\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}

enter image description here

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
deleted 39 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
  • First off, $y_2(t)=\cos(56t)+0.7\cos(56t-0.4)$
  • Then, useUse 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: Results

\begin{align} A &= \sqrt{(1+0.7\cos(0.4))^2 + (0.7\sin(0.4))^2}\\ B &= \text{arctan}\left(-\frac{0.7\sin(0.4)}{1+0.7\cos(0.4)}\right)\\ \omega &= 56 \end{align}\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}

enter image description hereenter image description here

a = 1+0.7*cos(056*0.4); 
b = 0.7*sin(056*0.4);

A = sqrt(a^2+b^2); % or abs(1+0.7*exp(-1i*0.4*56))
B = atan(-b/a); % or angle(1+0.7*exp(-1i*0.4*56))

t = (0:100);
y = cos(56*t) + 0.7*cos(56*t56*(t-0.4));
y2 = A*cos(56*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
  • First off, $y_2(t)=\cos(56t)+0.7\cos(56t-0.4)$
  • Then, 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: Results

\begin{align} A &= \sqrt{(1+0.7\cos(0.4))^2 + (0.7\sin(0.4))^2}\\ B &= \text{arctan}\left(-\frac{0.7\sin(0.4)}{1+0.7\cos(0.4)}\right)\\ \omega &= 56 \end{align}

enter image description here

a = 1+0.7*cos(0.4);
b = 0.7*sin(0.4);

A = sqrt(a^2+b^2);
B = atan(-b/a);

t = (0:100);
y = cos(56*t) + 0.7*cos(56*t-0.4);
y2 = A*cos(56*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
  • 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: Results

\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}

enter image description here

a = 1+0.7*cos(56*0.4); 
b = 0.7*sin(56*0.4);

A = sqrt(a^2+b^2); % or abs(1+0.7*exp(-1i*0.4*56))
B = atan(-b/a); % or angle(1+0.7*exp(-1i*0.4*56))

t = (0:100);
y = cos(56*t) + 0.7*cos(56*(t-0.4));
y2 = A*cos(56*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
added 619 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading
deleted 31 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading
added 41 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading
added 17 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading
deleted 37 characters in body
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading
Source Link
Jdip
  • 6.8k
  • 3
  • 8
  • 31
Loading