xcorr lag input to time?

3 ビュー (過去 30 日間)
Carly
Carly 2023 年 5 月 23 日
編集済み: Carly 2023 年 5 月 24 日
Hello,
I am trying to find the cross-correlation of two 1x180000 vectors (sigX and sigY). The sampling frequency is fs=1000. I am trying to find the xcorr with a lag of 30 s. How do I input the lag of -30:30 sec to the xcorr function given the sampling rate?
[c,lags] = xcorr(x,y,LAGS,'normalized');
The input 'm asking about is LAGS. Is this input in samples or time? If time, what unit of time?
Thank you

採用された回答

David Goodmanson
David Goodmanson 2023 年 5 月 24 日
編集済み: David Goodmanson 2023 年 5 月 24 日
Hi Carly,
lags is a dimensionless index, so it's in samples (it has to be samples since xcorr has no way of knowing what fs might be). Since sampling frequency times a time interval is the number of samples, the input to xcorr is LAGS = (-30:30)*fs, a dimensionless index.
(This is assuming that 30* fs is exactly an integer, otherwise some rounding will be involved).
  1 件のコメント
Carly
Carly 2023 年 5 月 24 日
thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by