plot 3d trajectory problem
45 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Chirag Gupta
il 22 Lug 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Earth and Planetary Science in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!