unable to calculate autocorrelation with a for loop by using xcorr

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by