co-variance Matrix formation
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
charles alexander
il 21 Nov 2020
{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.
Risposte (1)
BhaTTa
il 14 Ago 2025
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 Commenti
Vedere anche
Categorie
Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!