Help in Plotting X, Y and Heading Angle

3 views (last 30 days)
Pranjal Bhatia
Pranjal Bhatia on 18 Oct 2020
Answered: KSSV on 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 ?

Answers (1)

KSSV
KSSV on 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)

Categories

Find more on Mathematics in Help Center and File Exchange

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!