Filter löschen
Filter löschen

unable to calculate autocorrelation with a for loop by using xcorr

4 Ansichten (letzte 30 Tage)
I try to calculate the autocorrelation of a signal by using xcorr in this loop:
autc = nan(size({1, 1}));
for k=1:size({1, 1},2)
[rmm, lags] =xcorr({1, 1}(:,k));
rmm = rmm(lags>0);
autc(:,k) = rmm;
I get the error: Subscripted assignment dimension mismatch.
Any idea were the mismatch is?

Akzeptierte Antwort

Honglei Chen
Honglei Chen am 14 Nov. 2017
Looks like it should be
rmm = rmm(lags>=0)

Weitere Antworten (1)

toka55 am 14 Nov. 2017
That's it. Thanks


Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by