Cov variance function - how to reduce size of matrix

2 views (last 30 days)
Hi,
does anyone know how to go from a 5x25 matrix to a 5x10 matrix using the covariance cov function? Like how do you code this on matlab?
TIA
  3 Comments
scientist121
scientist121 on 2 Dec 2021
Okay so i have the 5x25 matrix of X where x=[A: B; C; D;E]
A = [2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50];
B = [3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75];
C = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25];
D = [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 35 36 38 39 30 35 37 39 41];
E = [ 1 5 7 9 2 35 7 9 0 6 7 9 1 3 4 5 8 9 2 0 3 8 3 7 4]
How would i use these vectors from the 5x25 matrix and find the co variance of this? Using the cov function to give a 5x10 matrix?
So far i have tried cov(X) and this is giving a 25x25 matrix so i am doing something wrong here...?
Jan
Jan on 3 Dec 2021
Why do you expect a 5x10 matrix? The covariance is mathematically defined and the givenoutput is the expected one.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!