how to make a cross section of lines and connect cross sections?
조회 수: 14 (최근 30일)
이전 댓글 표시
i have trajectory data(longitude, latitude, altitude).
I want to make a cross section of lines, which consist of data(longitude, latitude, altitude data). and connect i th boundray's vertices to i+1 th boundary's vertices, so i can make something like a tube.
the cross section(i will call it boundary) will be made using 'percentile'.
for example, if percentile is 100, the boundary includes every trajectory.
(In my case, the percentile will be 97.5.)
i know the process of this. but i have no idea of doing this by Matlab.
i will upload images of the process.
1) make a cross section at k th point of mean trajectory(red)
2) using percentile, make a boundary
3) connect k th boundray's vertices to k+1 th boundary's vertices
first image is the cross section of lines. red point is mean point of trajectory. and this boundary is made using 'specific percentile', so some trajectory data is out of boundary.
댓글 수: 0
채택된 답변
Star Strider
2022년 5월 25일
편집: Star Strider
2022년 5월 26일
I do not have your data, however consider something like this —
It would appear that the ‘y’ value is fixed in any specific location, so that it is only necessary to draw the percentile boxes with respecty to the ‘x’ and ‘z’ axes.
Example —
x = rand(1,5000)*10+125;
y = randn(1,5000)*50+250;
z = randn(1,5000)*150+300;
t = linspace(0, 1, 5000);
x = x + sin(2.5*pi*t)*125;
y = y + cos(1.5*pi*t)*125;
yv = linspace(min(y), max(y), 7); % Set 'Y' Values For The Box Locations
figure
scatter3(x,y,z,'.')
hold on
for k = 1:numel(yv)
yrng = find(y>=0.8*yv(k) & y <=1.2*yv(k));
xpctl = prctile(x(yrng),[2.5 97.5]);
zpctl = prctile(z(yrng),[2.5 97.5]);
xl(k,:) = xpctl;
zl(k,:) = zpctl;
patch([xpctl flip(xpctl)], [0 1 1 0]+yv(k), [[1 1]*zpctl(1) [1 1]*zpctl(2)], 'r', 'FaceAlpha',0.25)
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)
hold off
xlabel('X')
ylabel('Y')
zlabel('Z')
% xlim([120 140])
% ylim([100 400])
view(45,30)
Make appropriate changes in my code to work with your data.
EDIT — (26 May 2022 at 00:50)
Added lines connecting the patch corners. (Away for most of the day today so did not get the opportunity to do this until now.)
.
댓글 수: 7
Star Strider
2022년 5월 27일
I am not certain how to fix those problems.
My code is based on the information originally provided and the diagrams describing the desired result.
Perhaps adjusting the prctile limits will work, since the ‘xpctl’ value appears to be the problem.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Geographic Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!