Clustering Calculating total value

1 vue (au cours des 30 derniers jours)
Jess
Jess le 20 Juin 2019
Commenté : Walter Roberson le 21 Juin 2019
Sir
I have an Input matrix 90X2 matrix and another matrix C 4005X4 .
The following steps need to be performed
  1. Initially I have to select the (1,1) value and (1,2) value of C and store it in C1(1x2 matrix)
  2. Next I have to select the (1,3) value and (1,4) value of C and store it in C2 (1x2 matrix)
  3. Next I have to find the difference between each row of the matrix and C1 and store it in X(90x2 matrix)
  4. Next I have to find the difference between each row of the matrix and C2 and store it in Y (90x2 matrix
  5. Then I have to add the row values of X and store it in A(90x1 matrix)
  6. Then I have to add the row values of Y and store it in B((90x1 matrix)
  7. Then I have to compare the values of A and B. If A is greater, then number 2 should be stored in matrix Z and the smaller number among A and B should be stored in matrix M, else number 1 should be stored in matrix Z and the smaller number among A and B should be stored in matrix M. Now we have got an 90x1 Z matrix with values of either 1 or 2 and a 90x1 P matrix with the smaller values among A and B.
  8. Now I have to find the sum of all values of M and store it in P.
  9. Next I have to carry out the same procedure with the value of (2,1) and (2,2) as C1 and (2,3) and (2,4) as C2.
  10. Likewise I have to carry out the operation for all 4005 values of C
  11. Finally I have to find the value of C1 and C2 for which the value of P is minimum
Kindly help me with this

Réponses (1)

Walter Roberson
Walter Roberson le 20 Juin 2019
C1 = C(1,1:2);
C2 = C(1, 3:4);
X = YourArray - C1;
  2 commentaires
Jess
Jess le 21 Juin 2019
Sir
I have to do it for all the 4005 combinations
How to do it?
Plz help
Walter Roberson
Walter Roberson le 21 Juin 2019
for loop. Possibly using a cell array.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by