To plot x y z according to time
Show older comments
Hi,
I have a . txt with 4 colums : time (t), x, y, z which is the x, y, z position of an object according to the time.
I would like to plot the 3D position of this object.
% Data (10)
t= [0,513819900000000
1,01409700000000
1,53027800000000
2,04589800000000
2,54634500000000
3,11879600000000
3,62982200000000
4,14455800000000
4,65201000000000
5,15476100000000]
x=[0,0144918600000000
0,0197000400000000
0,0212137600000000
0,00879137000000000
-0,0430479900000000
-0,173410000000000
-0,293167400000000
-0,315159100000000
-0,306979900000000
-0,291601800000000]
y=[0,0624466500000000
0,0602231400000000
0,0604935700000000
0,0402826200000000
-0,00244453500000000
0,0134661700000000
0,0535583300000000
0,0605951400000000
0,0840618800000000
0,0692208900000000]
z=[0,0765380100000000
0,0890338800000000
0,104488400000000
0,122371500000000
0,181203300000000
0,0617616700000000
-0,0800978800000000
-0,174215400000000
-0,175980100000000
-0,137890000000000]
% Subplot of the deplacement
figure;
subplot(1,3,1); plot(t,x); title ('X to time');
subplot(1,3,2);plot(t,y); title ('Y to time');
subplot(1,3,3);plot(t,z); title ('Z to time');
% 3 plots in 1 figure
figure;
plot3(x,y,z)
hold on
scatter3(x,y,z,[],t,'filled')
box on
grid on
Can I make another plot, more representative of the deplacement or not?
Thank you very much.
AL
1 Comment
Luna
on 28 Jan 2019
The data you have provided is not understandable.
Why all x y z and t have 2 columns? (10x2 double array). Can you attach .txt file instead?
Accepted Answer
More Answers (3)
Anne-Laure GUINET
on 28 Jan 2019
0 votes
2 Comments
madhan ravi
on 28 Jan 2019
If you accept your comment as answer people will think that got an answer to your question so move this answer to the comment section above!
Anne-Laure GUINET
on 28 Jan 2019
Anne-Laure GUINET
on 30 Jan 2019
1 Comment
Luna
on 30 Jan 2019
Your welcome :)
Please use "comment on this answer" section instead of posting an answer.
u v w should be defined for quiver3 but I have never done that before.
If the answer works for you, please accept the answer :)
Okbah Alhafez
on 31 May 2021
0 votes
Hi,
my file is in csv format . should i convert the Form , or its ok ?
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!