I have a function that essentially calculates the distance beetween a set of points p1,p2,p3 and q1,q2,q3. I am looping through multiple sets of p1,p2,p3 and comparing against the q values which stay constant. I want to find which set of inputs of P maximises the distance beetween p and q. Does anyone know a way to do this?
data(: , :, 1) = [1 2 3]
data(: , :, 2) = [4 5 6]
data(: , :, 3) = [7 8 9]
my input is data, a 1x3x3 array but the general input will always be a 1xnx3 array.
Q will be the calculated median values for each channel/layer of data.
Q = [2 5 8]
Now I loop through each column of data, finding max distance.
for this case max distance is resulted from data(1,1,:) and data(1,3,:)
i would want it to always choose the first set of data that produces max.
How can i get a code on matlab to do this? any tips/tricks/help would be much appreciated