码迷,mamicode.com
首页 > 其他好文 > 详细

phase-VIV Post

时间:2020-04-13 22:56:11      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:signal   https   cross   diff   wave   ase   func   csharp   osi   

find the phase difference between two singnals

matlab code

% phase lag of sine and cosine function
% https://www.mathworks.com/help/signal/ug/cross-correlation-of-phase-lagged-sine-wave.html
rng default

t = 0:99;
x = cos(2*pi*1/12*t);  % 12 samples in one periods
y = sin(2*pi*1/12*t);
[xc,lags] = xcorr(y,x,24,‘coeff‘);  % ‘24‘ equal to 2 periods 

stem(lags(25:end),xc(25:end),‘filled‘)

hold on
plot (t,x)
%plot (t,y)
plot([2.5 2.55],[-1 1])

ax = gca;
ax.XTick = 0:2.5:20;

 

phase-VIV Post

标签:signal   https   cross   diff   wave   ase   func   csharp   osi   

原文地址:https://www.cnblogs.com/code-saturne/p/12694333.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!