how to make patch which is perpendicular to the line?

17 views (last 30 days)
I have longitude, latitude, altitude data which is aircraft data.
I made patches which contain trajectory(consisting of lon,lat,alt data) and connect i th patch's vertices to i+1 th patch's vertcies.
(I used percentile to make a patch. ex) if percentile is 100, the patch contains every trajectory. In my case, I used 97.5 percentile.)
but the patch is slightly titled when viewing from the top.
(maybe it is because I fixed the 'y' values(longitude) to make a patch. but I don't know how to modify my code.)
So I want to make a patch which is perpendicular to mean trajectory(the line).
I will attach the images and the code.
first image is what i did.
second and third is what i want to plot.
Let me know how to solve this problem.
Thanks!
for i = 1:length(33R)
plot3(33R(i).Longitude, 33R(i).Latitude, 33R(i).BAlt)
hold on
end
hold on
xlabel('X')
ylabel('Y')
zlabel('Z')
yv = [];
yv = [yv;mean_trajectory.Latitude];
for i = 1:length(trajectory)
xptcl = prctile(trajectory(i).Longitude,[2.5 97.5]);
zptcl = prctile(trajectory(i).Altitude,[2.5 97.5]);
xl(i,:) = xptcl;
zl(i,:) = zptcl;
patch([xptcl flip(xptcl)], [0 0 0 0]+yv(i), [[1 1]*zptcl(1) [1 1]*zptcl(2)],'r', 'FaceAlpha',0.5)
end
plot3(xl(:,1), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,1), yv(:), zl(:,2), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,1), '-k', 'LineWidth',2)
plot3(xl(:,2), yv(:), zl(:,2), '-k', 'LineWidth',2)
grid on

Answers (0)

Community Treasure Hunt

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

Start Hunting!