I have a matrix of data which is the coordinates of some points and coordinates of 5 clusters
data = [randi(100,100,1),randi(100,100,1)];
x_Clusters = [20 5 12 88 61];
y_Clusters = [10 50 14 41 10];
Coordinates_Of_Clusters = [x_Clusters',y_Clusters'];
I want to use norm function to determine the distances from the centers of 5 known clusters which are the above coordinates to my data. How could I do that?
The funtion
norm(X)
is the same asnorm(X,2)
. Matlab uses the 2-norm (Euclidean distance) by default.Using your code to begin:
Then use for loops for all clusters (
n_clusters
) and for each point (n_points
):