plot 3d trajectory problem
45 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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;
0 Kommentare
Akzeptierte Antwort
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Earth and Planetary Science 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!