calculate values from different matrices
Show older comments
I have a matrix U (n*v). I want for every column to have a matrix that has the number of the non-zero rows. For example U= [1 1 0; 2 0 2; 4 3 0; 4 0 0; 0 5 1; 3 1 3; 1 0 5; 0 2 1] will return for v1=1 [1 2 3 4 6 7], v2=2 [1 3 5 6 8], v3=3 [2 5 6 7 8]. Then, we have another matrix K (n*n) and we want for every new matrix we created before(v1 v2 v3) , to take the 5 nearest to zero values. for example [0.1 0.5 0.2 0.25 0.3 -0.1 0.4 0.35; 0.3 0.3 0.2 0.25 0.3 -0.1 0.4 0.35; 0.15 0.5 0.4 0.25 0.3 -0.1 0.4 0.35; -0.4 0.5 0.2 0.6 0.3 -0.1 0.4 0.35; 0.3 0.5 0.2 0.25 0.12 -0.1 0.4 0.35; 0.15 0.5 0.2 0.25 0.3 -0.1 0.4 0.35; 0.3 0.5 0.2 0.25 0.3 -0.1 0.213 0.35; 0.125 0.5 0.2 0.25 0.3 -0.1 0.4 0.12]
for row 1 is [1 3 4 6 7]
then, we want to create a new matrix A where every element is the sum of each absolute value of K multiplied with the respective values of U, and the sum will be divided by the sum of the 5 absolute values from K. For example: A(1,1)= {1*0.1+4*0.2+4*0.25+3*|-0.1|+1*0.4}/(0.1+0.2+0.25+|-0.1|+0.4)
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!