plot 3d trajectory problem

조회 수: 89 (최근 30일)
shady
shady 2011년 7월 22일
hey every one
i try to plot a trajectory in 3d , i write the command & execute it then the program draw it in 2d but when i identify a point i find it 3d , can any one help me to realise the 3d view of the particle trajectory ??
xp , yp & zp are 3 massive matrices for multi-particules in different ietration times,
here i just try to plot in 3d the trajectory of one particle only,
please help,
thank you in advance;
here is the code used :
xp1=xp(1,:); yp1=yp(1,:); zp1=zp(1,:);
hold on;
plot3 (xp1,yp1,zp1);
% plot (xp(1,:),yp(1,:),'b');
hold off;

채택된 답변

Chirag Gupta
Chirag Gupta 2011년 7월 22일
It looks good to me: Here's my sample code
% Sample trajectory
t = 0:0.1:10;
x = 5*cos(t);
y = 5*sin(t);
z = sin(t)+cos(t)+t;
plot3(x,y,z,'*r');
%if you want to animate it
for i=1:length(x)
plot3(x(i),y(i),z(i),'*r');
hold on;
pause(0.01);
end
  댓글 수: 1
shady
shady 2011년 7월 22일
ya it is the same as in the help of matlab but i need it for my own data & code written , thnx

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by