Filter löschen
Filter löschen

plot 3d trajectory problem

62 Ansichten (letzte 30 Tage)
shady
shady am 22 Jul. 2011
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;

Akzeptierte Antwort

Chirag Gupta
Chirag Gupta am 22 Jul. 2011
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 Kommentar
shady
shady am 22 Jul. 2011
ya it is the same as in the help of matlab but i need it for my own data & code written , thnx

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by