plot 3d trajectory problem
45 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Earth and Planetary Science 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!