co-variance Matrix formation
1 回表示 (過去 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!