Data vusualization - How to align data sets?
5 次查看(过去 30 天)
显示 更早的评论
Hallo,
I have two vectors. Each one contains data from two different devices wich measure the same periodic variable.
I would like to compare this two measurments sets without the aparent delay between them:
![](https://www.mathworks.com/matlabcentral/images/broken_image.png)
Is there a function in Matlab that could help to "align" the data sets? It would be actually enough to plot two periods.
Thank you.
0 个评论
采纳的回答
Leah
2013-8-20
I would probably do the circshift function and search for the highest correlation. But if the first minimum works wells then stick with that.
Remember when you circshift that the values loop around so the the beginning of your time series (however many steps you shifted by) is not longer valid and should be removed from the analysis.
Here's a simple example of what I'm suggesting
series1=cos(0:.1:8*pi())';
series2=sin(0:.1:8*pi())';
plot(series2,'r')
hold on
plot(series1)
for t=1:64 % 64 is one period length
cm=corrcoef(series2,circshift(series1,t));
c(t)=cm(1,2);
end
[~,I] = max(c); % I is best value for circshift
0 个评论
更多回答(1 个)
the cyclist
2013-8-14
Are you trying to get MATLAB to figure how much to shift, or are you going to do that manually? If that latter, then you could probably just use the circshift() function.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!