I have created two complex exponential functions in MATLAB, both have same frequency but different phase. The MATLAB code used to create complex exponential functions is given below:
% First complex exponential generation
Fs = 5000; % sampling frequency
f1 = 5; % frequency
vector = linspace(0,1,Fs);
exp1 = exp(1i*(2*pi*f1.*vector));
% Second complex exponential generation
Fs = 5000;
f1 = 5;
vector = linspace(0,1,Fs);
exp2 = exp(1i*(2*pi*f1.*vector)).*exp(1i*pi/7); % Giving phase shift of pi/7
I want to calculate the phase difference between these two functions (which is known in this case i.e pi/7) so that in real situation, this phase shift can be used as a feedback to correct the phase difference and both functions can become exactly same.