regarding phase compensation?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sanjoy Basak
il 26 Dic 2016
Risposto: BRIAN PENG
il 13 Dic 2021
Hello,
I am trying to do simple phase compensation. However, the code is always making some extra phase correction. Its not making an exact compensation. Please have a look at the code. I think I am formulating it wrongly. Although theta estimation is pretty correct.
theta = pi/5;
t=(0:1000)/1000;
freq = 20;
s1 = sin(2*pi*freq*t);
s2 = sin(2*pi*freq*t + theta);
theta_estimate = acos( 2*mean( s1.*s2) );
s3=s2*(cos(theta_estimate)+(1i*sin(theta_estimate)));
s3 and s1 are not completely phase synced.
0 Commenti
Risposta accettata
Soumya Saxena
il 29 Dic 2016
I understand that you are trying to do phase compensation. Please note that a shift in time domain is equivalent to multiplication in frequency domain.
The value of 'theta_estimate" seems to be accurate.
However, one way to perform phase synchronization is to take the Fourier transform of the signal s2, and store it in S2. In the frequency domain, we can multiply S2 with exp(-theta_estimate*i/length(S2)). This is equivalent to shifting the phase of s2 by theta_estimate. We can then obtain the inverse Fourier transform of this product.
Please refer to the following code snippet:
theta = pi/5;
fs = 1000;
t=(0:1000)/fs;
freq = 20;
s1 = sin(2*pi*freq*t);
s2 = sin(2*pi*freq*t + theta);
theta_estimate = acos( 2*mean( s1.*s2) );
%Calculate fft of s2
S2 = fft(s2);
% Multiplication in frequency domain means, shift by "theta_estimate" in time domain. This will
% subtract "theta_estimate" from s2.
S3 = S2.*exp(-i*theta_estimate/(length(S2)));
% Take inverse fft to get signal in time domain
s3p = ifft(S3);
%Calculate the time shift
time_shift_num = theta_estimate/(2*pi*freq)
% Plot both the signals
figure
plot(t,s1,'r*')
hold on
plot(t+time_shift_num,real(s3p),'b--')
The plots should not have phase shift between them now.
0 Commenti
Più risposte (1)
BRIAN PENG
il 13 Dic 2021
Hello, sir, in the code above:
- S3 = S2.*exp(-i*theta_estimate/(length(S2)));
Why we have to divide it by length(S2)?
2. plot(t+time_shift_num,real(s3p),'b--')
Why we have to add "time_shift_num" to do phase shift since suppose we have done the phase shift
in frequence already [S3 = S2.*exp(-i*theta_estimate/(length(S2)));]
3. It seems the phase shift is compensated by time shift, not frequency multiplication. Can you share articles or documentation on this?
Thank you!
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!