Help in Plotting X, Y and Heading Angle

3 vues (au cours des 30 derniers jours)
Pranjal Bhatia
Pranjal Bhatia le 18 Oct 2020
Réponse apportée : KSSV le 18 Oct 2020
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 ?

Réponses (1)

KSSV
KSSV le 18 Oct 2020
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)

Catégories

En savoir plus sur Red dans Help Center et File Exchange

Tags

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by