Clustering Calculating total value
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!