如何移动/调整所有散点数据点,以使质心为0,0?
脚本:
dataFile = dlmread('E:\C.txt'); % file stored in https://ufile.io/km74t
uniqueTable = unique(dataFile,'rows')
dataTable = array2table(uniqueTable,'VariableNames',{'X','Y'})
xCord=dataTable{:,1}
yCord=dataTable{:,2}
scatter(xCord,yCord)
hold on;
centroidX = mean(xCord)
centroidY = mean(yCord)
scatter(centroidX,centroidY)