how to make a cross section of lines and connect cross sections?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sierra
el 25 de Mayo de 2022
Comentada: Star Strider
el 27 de Mayo de 2022
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 comentarios
Respuesta aceptada
Star Strider
el 25 de Mayo de 2022
Editada: Star Strider
el 26 de Mayo de 2022
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 comentarios
Star Strider
el 27 de Mayo de 2022
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!