unable to calculate autocorrelation with a for loop by using xcorr

2 ビュー (過去 30 日間)
toka55
toka55 2017 年 11 月 14 日
回答済み: toka55 2017 年 11 月 14 日
I try to calculate the autocorrelation of a signal by using xcorr in this loop:
autc = nan(size(dec.cd{1, 1}));
for k=1:size(dec.cd{1, 1},2)
[rmm, lags] =xcorr(dec.cd{1, 1}(:,k));
rmm = rmm(lags>0);
autc(:,k) = rmm;
end;
I get the error: Subscripted assignment dimension mismatch.
Any idea were the mismatch is?

採用された回答

Honglei Chen
Honglei Chen 2017 年 11 月 14 日
Looks like it should be
rmm = rmm(lags>=0)
HTH

その他の回答 (1 件)

toka55
toka55 2017 年 11 月 14 日
That's it. Thanks

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by