How can I do a Crosscorrelation between a vector and a cell

1 回表示 (過去 30 日間)
Paola
Paola 2021 年 12 月 17 日
編集済み: Voss 2021 年 12 月 17 日
Hi everyone,
I have a vector sample(2x5010) that I need to crosscorellate with a matrix sim(51x5010). I have to cross-correlate each rows of the vector with each rows of the matrix and I would like to have the crosscorrelation matrix and the lags vector. To do so I am using a loop and I would like to generate a cell hh{2X51} with the crosscorrelated vectors and a vector lags (2x51) with the lag values. It is not working, Can you help me with that? thanks
for i=1:size(sample,1)
for j=1:size(b_nor,1)
[hh, lags]=xcorr(nor_sam(i,:),b_nor(j,:));
end
end
paola

採用された回答

Voss
Voss 2021 年 12 月 17 日
編集済み: Voss 2021 年 12 月 17 日
ns = size(nor_sam,1);
nb = size(b_nor,1);
hh = cell(ns,nb);
lags = cell(ns,nb);
for i = 1:ns
for j = 1:nb
[hh{i,j}, lags{i,j}] = xcorr(nor_sam(i,:),b_nor(j,:));
end
end

その他の回答 (0 件)

カテゴリ

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