# How to center a cloud of data points (x,y,z) to coordinate origin in 3-D space?

2 views (last 30 days)
Pengyu Chen on 19 Dec 2021
Answered: Jan on 19 Dec 2021
For gait analysis, I have multiple markers moving in 3-D space during the duration of 10 seconds and I'd like to center the each marker's 3-D coordinate (x,y,z) around the origin of coordinate (0,0,0). I'm wondering if there's a toolbox/function to achieve this?
For simplicity, I'll attach an example of 10 ms of one marker.
X (mm) y (mm) z (mm)
167.282166 372.896698 389.281158
167.471191 372.208740 389.362701
167.996216 372.071564 389.467804
168.180084 371.414276 389.551056
168.273346 370.742065 389.593597
168.421082 370.094299 389.734467
168.310608 369.163635 389.730011
168.288498 368.446075 389.701782
168.616959 368.038177 389.85672
168.659393 367.369171 389.916443

Jan on 19 Dec 2021
I'm not sure, what "center each marker" means. But I assume you want to subtract the mean value:
trajectory = [167.282166 372.896698 389.281158; ...
167.471191 372.208740 389.362701; ...
167.996216 372.071564 389.467804; ...
168.180084 371.414276 389.551056];
centered_trajectory = trajectory - mean(trajectory, 1);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!