List of xyz coordinates for two vectors that continuously change through time, how to find angle between the two vectors as time passes and their coordinates change?

5 views (last 30 days)
Hi,
I have an excel file with a list of coordinates. I am only using columns [3:8]. These columns represent two points and their x,y,z coordinates respectively. The list is 421 rows long, below is a small section of the list to provide an example.
time Source x source y source z fusion x fusion x fusion z
1 0 23.6941000000000 579.700000000000 1223.33000000000 49.4259000000000 581.346000000000 104.230000000000
2 0 23.6883000000000 579.718000000000 1223.31000000000 49.4150000000000 581.310000000000 104.208000000000
3 0 23.6925000000000 579.732000000000 1223.30000000000 49.4202000000000 581.265000000000 104.198000000000
4 0 23.6919000000000 579.741000000000 1223.32000000000 49.4326000000000 581.195000000000 104.212000000000
I have split up the csv file to create point1 (Source x, y, z) which contains entries 3-5 from the list and point 2 (fusion x, y, z) which contains entries 6-8 from the list.
I am trying to calculate the angles in all planes of space between point 1 and point 2 as they change coordinates as time passes.
I am really stuck trying to make a vector that continously updates as the coordinates change. I have tried doing a for loop but I cant get it to work, because I cant create these vectors I cannot calculate the angles between the vectors as time passes.
The vector is from point 1 to point 2 and it constantly changes poistion as time passes (Column 1).
At the moment I have;
ViconStatic = readmatrix('NewStaticTestSensor.csv');
MotionSenseStatic = readmatrix('67CT_log_07062021_14-37-34');
%% Import vicon coordinates
%Time
time = linspace(1,421,421)./1000;
time_Sec = reshape(time,421,1);
% Source sensor coordinates
Sourcex = ViconStatic(1:421,3);
Sourcey = ViconStatic(1:421,4);
Sourcez = ViconStatic(1:421,5);
% Fusion sensor coordinates
Fusionx = ViconStatic(1:421,6);
Fusiony = ViconStatic(1:421,7);
Fusionz = ViconStatic(1:421,8);
%% Creating moving vectors
r=1;
for s=0:1:421
p1x(r,1)= Sourcex(s+1,1);
r=r+1;
end
Any help would be greatly appreciated.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by