# How to calculate phase angle between two sine wave from vectors

89 visualizaciones (últimos 30 días)
DEBASHIS PANDA el 3 de Dic. de 2015
Respondida: Taha el 31 de Dic. de 2015
Hi.. After solving my problem I am getting two sine waves. These two waves are variations of current and voltage. I want to determine the phase angle between them. Actually I have got graphs I have attached here.In
my case I want to determine it from vectors (numeric values).If I will FFT is it correct
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (3)

Taha el 31 de Dic. de 2015
% %
% %
close all;
clear all;
x = 0:1e-6:60e-3; % bis 60 ms mit 1µs Schritte
a = sin(2*pi*50*x);
b = sin(2*pi*50*x-pi);
plot(x,a,x,b)
xlabel(['Winkel in degree ist: ',num2str(y_deg)],'Color','r')
grid on
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

David Young el 3 de Dic. de 2015
If you know the frequency, it is probably more accurate to fit a sine wave to each of the two vectors than to use the FFT. The problem with the FFT is that it fits harmonics of a wave whose period is equal to the length of the time series, and your signal may not lie at exactly one of those frequencies.
There are several contributions on the file exchange for fitting sine waves (search "harmonic fit"), and my own function is attached, or you could write your own.
Once you have fitted a sine wave to each data series, you just subtract the phase of one from the phase of the other.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Taha el 31 de Dic. de 2015
and here is the code: close all; clear all; x = 0:1e-6:60e-3; % bis 60 ms mit 1µs Schritte a = sin(2*pi*50*x); b = sin(2*pi*50*x-pi);
y_rad=acos(dot(a,b)/(norm(a)*norm(b))) y_deg=y_rad*360/(2*pi) plot(x,a,x,b) xlabel(['Winkel in degree ist: ',num2str(y_deg)],'Color','r') grid on
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Pulsed Waveforms en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by