SetDirectory["/home/alex/Programming/esp/uas-ugv"]

data=Import["ugv4_moving.csv",HeaderLines->1];
magdata=data[[All,7;;9]];

plotdata[data_]:=ListPlot[{data[[All,1;;2]],data[[All,2;;3]],Transpose[{data[[All,3]],data[[All,1]]}]},AspectRatio->1]

plotdata[magdata]

magavgs=Mean[magdata]

magmeds=Median[magdata]

maghalfs=((Max[#]+Min[#])/2)&/@Transpose[magdata]
-maghalfs

magdata2=#-maghalfs&/@magdata;
plotdata[magdata2]

Norm/@magdata2;
Histogram[%]

Histogram[Transpose[magdata2]]

magranges=((Max[#]-Min[#])/2)&/@Transpose[magdata2]
1/magranges
md=DiagonalMatrix[%];
md[[{1,2}]]=md[[{2,1}]];
md[[1]]=-md[[1]];
Flatten[md]

magdata3=#/magranges&/@magdata2;
plotdata[magdata3]

Norm/@magdata3;
Histogram[%]

Graphics3D[Point/@magdata3,Axes->True,AspectRatio->1]