How to create a matrix of correlation values
2 次查看(过去 30 天)
显示 更早的评论
Hi all,
I'm a new to Matlab and only know the bascis. I have a data set with 20 x 150 columns. I need to find the correlation of the 20 values in the first column with themselves & create a matrix of size 20*20 which represents correlation of these 20 values with each other.
I've figured out the easy part, creating the 1 x 20 matrix from the loaded file: A=data(1:20);
What I can't figure out is a way to generate the 20x20 matrix representing the correlation of the 20 values with each other.
I've tried all of the following, to no avail:
corr2(A,A) % answer ends up as '1'
corr(A',A') % answer ends up as '1'
corrcoef(A,A) % results in a 2x2 matrix of '1' values)
corr(A,A) % this DOES create a 20x20 matrix, but all the values are NaN
Can someone please help me? Thanks in advance!
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!