Correlation between two vectors
49 ビュー (過去 30 日間)
古いコメントを表示
How to show the correlation between two vectors? I know I can use the function 'xcorr', but is there a function that shows graphically this correlation?
0 件のコメント
採用された回答
Adam Danz
2019 年 7 月 1 日
編集済み: Adam Danz
2019 年 7 月 15 日
n = 0:15;
x = 0.84.^n;
y = circshift(x,5);
[c,lags] = xcorr(x,y);
stem(lags,c)
xlabel('lag')
ylabel('r')
or more simply,
plot(lags, c, '-o')
This shows a maximum correlation at lag -5 which makes sense since we circularly shifted the data by 5 units.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!