How Can I Calculate Correlation Coefficients for large matrix column-wise?

4 ビュー (過去 30 日間)
Isa Samad
Isa Samad 2020 年 10 月 8 日
回答済み: Luciano Garim 2020 年 10 月 8 日
Hi there,
I'm still somewhat new to using MATLAB for quantitative analysis but I have a 800 x 43 matrix called M. I would like to calculate the correlation coefficients for every term in a single row for all 800 rows (left to right) such that after inputting it into the command window, I receive an 800 x 1 vector. For example in the 1st row, I want to calculate how the coefficients between all 44 values from left to right in that 1st row and repeat that for each row after. Is this possible in MATLAB using the corrcoef function? Currently I've tried both of these inputs, however, I receive a 43 x 43 matrix upon entering the commands instead of a 800 x 1 column vector.
R = corrcoef(M(1:800,:))
R = corrcoef(M(:,:))

回答 (1 件)

Luciano Garim
Luciano Garim 2020 年 10 月 8 日
Hi, Isa Samad!
If I understood your problem, you may solve it using the next few lines:
for i=1:size(M,1)
corelation(:,i)=corrcoef(M(i,:))
end
I hope helped you!

カテゴリ

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