co-variance Matrix formation
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi
I have 6 row matrix of size 1x6
I need to calculate the co variance of all the matrices but cov command only taking two matrices as input
I want a co variance matrix of 6x6
Regards
Uzmeed
댓글 수: 1
charles alexander
2020년 11월 21일
{a1n a2n a6n} by {a2 a6} by {1 1}
{1 a2 a1n} {1 1} {1 sigma 36}.
try the matrix above. the last matrix on the right is the matrix you need. the one that ends with sigma 36.
i hope this helps.
답변 (1개)
BhaTTa
2025년 8월 14일
I understand you want to calculate a 6x6 covariance matrix from 6 row vectors (each of size 1x6). Please refer to the solution below I have assume that you have 6 seperate row vectors:
% Example: If you have 6 row vectors like this:
row1 = [1, 2, 3, 4, 5, 6];
row2 = [2, 3, 4, 5, 6, 7];
row3 = [3, 4, 5, 6, 7, 8];
row4 = [4, 5, 6, 7, 8, 9];
row5 = [5, 6, 7, 8, 9, 10];
row6 = [6, 7, 8, 9, 10, 11];
% Combine them into a 6x6 matrix (each row is one observation)
data_matrix = [row1; row2; row3; row4; row5; row6];
% Calculate 6x6 covariance matrix
cov_matrix = cov(data_matrix);
disp('6x6 Covariance Matrix:');
disp(cov_matrix);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!