% plotCompExp - Illustrate that sum of two conjugate complex explonentials
% yields a sinusoid

%% parameters
A=1;
f = 2;
phi = pi/4;

%% create two conjugate complex exponentials
tt = 0:0.001:3/f;
xx = A/2*exp(1j*(2*pi*f*tt + phi));
xxc = A/2*exp(-1j*(2*pi*f*tt + phi));

%% 3-D plot of complex exponentials
plot3(tt, real(xx), imag(xx));
hold on
plot3(tt, real(xxc), imag(xxc), 'r');

%% 3-D plot of the sum (which is just a sinusoid, i.e., 2-D)
plot3(tt, real(xx+xxc), imag(xx+xxc), 'k');

xlabel('Time')
ylabel('real')
zlabel('imag')

grid on

hold off