How to extract the constant phase of a sine wave?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I would extract the phase of a simple signal, for example a sine wave:
phase = pi/2;
x = sin(omega*t + phase);
I tried with
P = angle(x)
but in this case, if I plot (t,P) I obtain a variable phase. I want the exact phase equal to pi/2, so a constant curve. Do you know how to do it?
0 comentarios
Respuestas (2)
Honglei Chen
el 7 de Nov. de 2017
Do you know omega? If so, you can do something like this
fc = 10;
omega = 2*pi;
t = (0:9)/10;
p = pi/2;
x = sin(omega*t+p);
xc = hilbert(x);
xcref = hilbert(sin(omega*t));
P = mean(angle(xc.*conj(xcref)))
Here I'm using analytic signal to simplify the math a bit. you can also do it in real domain but then you need a low pass filter to remove the unwanted frequency after mixing.
HTH
0 comentarios
David Sziroczak
el 9 de Nov. de 2017
If it's such a simple function you are after, wouldn't it be possible just to simply extract value of the function at t=0 or pi or similar, and get the angle from asin?
Other idea, you could do a complex FFT and work it out from that?
Hope this helps,
David
0 comentarios
Ver también
Categorías
Más información sobre Transforms 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!