Help in Plotting X, Y and Heading Angle

조회 수: 3 (최근 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 CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by