How to extract the constant phase of a sine wave?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Honglei Chen
2017-11-7
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 个评论
David Sziroczak
2017-11-9
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!