Hi,
It is not clear what you are trying to do here. I am assuming this is what you want :
You have 4 points as follows :
XY = [0 0; 1 0 ; 1 1; 0 1];
To compute the average of these 4 points, you can use the 'mean' function :
C = mean(XY);
In the above example, the XY points define the 4 corners of a unit square and the mean of the 4 points would give you the centroid of the square i.e. (0.5,0.5).
You can use plot/scatter functions to display the square and the centroid as follows :
%Plot the square
plot([XY(:,1);XY(1,1)],[XY(:,2);XY(1,2)]);
hold on;
%display the centroid
scatter(C(1),C(2),'r+')
Hope this helps!
Best Regards,
Vaidyanathan