So I have to write a function that will find the euclidean distance between every pair of points, given a set of data points X. Can anyone help me with this. I am not very good with Matlab.
function [DM] = distance_matrix (X)
Assume that data points in X are represented by the rows of that matrix (there is no class label or
target value in the last column).
Note that you can build this function from code knn.m (attached here) with
minor modifications. Example output you can use to test your code:
X = [1 2 3 4; 5 6 7 8; 9 10 11 12];
distance_matrix(X)
ans = 0 8 16
8 0 8
16 8 0