Clustering Calculating total value
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sir
I have an Input matrix 90X2 matrix and another matrix C 4005X4 .
The following steps need to be performed
- Initially I have to select the (1,1) value and (1,2) value of C and store it in C1(1x2 matrix)
- Next I have to select the (1,3) value and (1,4) value of C and store it in C2 (1x2 matrix)
- Next I have to find the difference between each row of the matrix and C1 and store it in X(90x2 matrix)
- Next I have to find the difference between each row of the matrix and C2 and store it in Y (90x2 matrix
- Then I have to add the row values of X and store it in A(90x1 matrix)
- Then I have to add the row values of Y and store it in B((90x1 matrix)
- 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.
- Now I have to find the sum of all values of M and store it in P.
- 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.
- Likewise I have to carry out the operation for all 4005 values of C
- Finally I have to find the value of C1 and C2 for which the value of P is minimum
Kindly help me with this
0 comentarios
Respuestas (1)
Walter Roberson
el 20 de Jun. de 2019
C1 = C(1,1:2);
C2 = C(1, 3:4);
X = YourArray - C1;
2 comentarios
Ver también
Categorías
Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!