3D trajectories plot

2 ビュー (過去 30 日間)
ruik zhang
ruik zhang 2018 年 7 月 25 日
コメント済み: KSSV 2018 年 7 月 25 日
Hello, I have a matrix such as [1 2 3; 4 5 6; 1 3 5; 2 6 9], how to plot 3D trajectories from point [1 2 3] to [4 5 6] then from [4 5 6] to [1 3 5], then from[1 3 5] to [2 6 9] etal? namely, the neighbour points are connected with an arrow line. Thank you

回答 (1 件)

KSSV
KSSV 2018 年 7 月 25 日
P = [1 2 3; 4 5 6; 1 3 5; 2 6 9] ;
[nx,ny] = size(P) ;
figure
hold on
for i = 1:nx-1
v=[P(i,:);P(i+1,:)];
plot3(v(:,1),v(:,2),v(:,3),'r')
end
  2 件のコメント
KSSV
KSSV 2018 年 7 月 25 日
Rick commented:Thank you, KSSV, it is very close to the answer I want. Is it possible add the arrow at the end of each line fragment?
Best,
Rick
KSSV
KSSV 2018 年 7 月 25 日
Very much possible ...use quiver3

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by