Multiple 3D trajectories displayed on same axis
显示 更早的评论
Hello,
I'm trying to visualize a 3D flight trajectory of a bird. I've gathered the positional data for multiple flights and am trying to have multiple flight paths visualized on the same axis with their starting and ending point shown as well.
My code is very elementary but I'm not sure why it isn't working? It usually outputs just the first dive instead of the three?
%3D position data
x1 = DdatafiltDive02(:,1);
y1 = DdatafiltDive02(:,2);
z1 = DdatafiltDive02(:,3);
x2 = DdatafiltDive04(:,1);
y2 = DdatafiltDive04(:,2);
z2 = DdatafiltDive04(:,3);
x3 = DdatafiltDive06(:,1);
y3 = DdatafiltDive06(:,2);
z3 = DdatafiltDive06(:,3);
%removing NaN values
x1_2 = rmmissing(x1);
y1_2 = rmmissing(y1);
z1_2 = rmmissing(z1);
x2_2 = rmmissing(x1);
y2_2 = rmmissing(y1);
z2_2 = rmmissing(z1);
x3_2 = rmmissing(x1);
y3_2 = rmmissing(y1);
z3_2 = rmmissing(z1);
%Fig
f4 = figure;
plot3(x1_2,y1_2,z1_2,x2_2,y2_2,z2_2,x3_2,y3_2,z3_2)
hold on
grid on
xlabel('Meters')
ylabel('Meters')
zlabel('Meters')
plot3(x1_2(1,:),y1_2(1,:),z1_2(1,:),'go', 'MarkerSize', 25)
plot3(x1_2(end,:),y1_2(end,:),z1_2(end,:),'ro', 'MarkerSize', 25)
plot3(x2_2,y2_2,z2_2,'*y')
plot3(x2_2(1,:),y2_2(1,:),z2_2(1,:),'go', 'MarkerSize', 25)
plot3(x2_2(end,:),y2_2(end,:),z2_2(end,:),'ro', 'MarkerSize', 25)
plot3(x3_2,y3_2,z3_2,'*b')
plot3(x3_2(1,:),y3_2(1,:),z3_2(1,:),'go', 'MarkerSize', 25)
plot3(x3_2(end,:),y3_2(end,:),z3_2(end,:),'ro', 'MarkerSize', 25)
hold off
1 个评论
dpb
2021-10-17
Attach the data as a .mat file -- nothing seems obvious from the code, although one would expect things to get pretty messy with 3D data, it should still show up.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Exploration and Visualization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!