Help in Plotting X, Y and Heading Angle

12 ビュー (過去 30 日間)
Pranjal Bhatia
Pranjal Bhatia 2020 年 10 月 18 日
回答済み: KSSV 2020 年 10 月 18 日
Say there are 15 Column vectors where the first 5 columns correspond to X position of first 5 Agents, the next 5 columns correspond to the Y positon and the last 5 towards the heading angle ( Theta ) and say the number of rows for all are 64. So there is a 64X15 Vector say V where
V( : , 1:5 ) = X % This is for 5 agents i.e 1 Column corresponds to Variation of a single agent through time
V( : , 6:10 ) = Y
V( : , 11:15 ) = Theta
How do I plot these 5 Agents on a common graph seeing how they are traversing ?

回答 (1 件)

KSSV
KSSV 2020 年 10 月 18 日
Let V be your 64*15 data matrix.
X = V(:,1:5) ;
Y = V(:,6:10) ;
Z = V(:,11:15) ;
% If you want a surface and the data corresponds to surface
figure(1)
pcolor(X,Y,Z)
shading interp
colorbar
figure(2)
surf(X,Y,Z)
shading interp
colorbar
% If the points correspond to lines
x = X(:) ;
y = Y(:) ;
z = Z(:) ;
plot3(x,y,z)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by