To plot x y z according to time
이전 댓글 표시
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
Luna
2019년 1월 28일
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?
채택된 답변
추가 답변 (3개)
Anne-Laure GUINET
2019년 1월 28일
0 개 추천
댓글 수: 2
madhan ravi
2019년 1월 28일
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
2019년 1월 28일
Anne-Laure GUINET
2019년 1월 30일
댓글 수: 1
Luna
2019년 1월 30일
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
2021년 5월 31일
0 개 추천
Hi,
my file is in csv format . should i convert the Form , or its ok ?
카테고리
도움말 센터 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!