
Problem with data triangulation
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
LEONARDO BARNESCHI
le 10 Mai 2020
Réponse apportée : darova
le 10 Mai 2020
Dear Matlab users,
I am trying to visualize a surface made of 3d scattered points. It is not an F(x,y) -> z function, z is just a scalar associated to (x,y) pairs. The x and y pairs form a fairly uniform rectangular grid on the xy plane. However, as soon as I try to use trisurf, the data are triangulated in an unexpected fashion.
I am actually interested in "connecting" these 3d points, not in an interpolation. The surface which can be glimpsed from scatter3 appears to be quite regular, but I wasn't succesfull in using trisurf or even surf.
Can you help me in achieving this goal? I am probably missing something in how the delaunay triangulation works.
Thank you in advance,
Leonardo
0 commentaires
Réponse acceptée
darova
le 10 Mai 2020
It's because of different scales

try to scale your data
dx = max(x)-min(x);
y1 = (y-min(y))/(max(y)-min(y))*dx;
T = delaunay(x,y1);
trisurf(T, x, y, z)
axis vis3d
0 commentaires
Plus de réponses (1)
Ameer Hamza
le 10 Mai 2020
Modifié(e) : Ameer Hamza
le 10 Mai 2020
If you want to visualize the data as surface, then you can first use griddata() to make it into a grid and then use surf()
x = [-108.743 -108.734 -108.71 -108.699 -108.684 -108.674 -108.664 -108.656 -108.651 -108.647 -108.645 -107.259 -107.216 -107.179 -107.148 -107.123 -107.123 -107.105 -107.104 -107.094 -107.093 -107.09 -105.784 -105.731 -105.683 -105.641 -105.605 -105.574 -105.55 -105.533 -105.523 -105.522 -105.519 -104.318 -104.255 -104.197 -104.144 -104.096 -104.054 -104.017 -103.986 -103.962 -103.944 -103.932 -102.862 -102.789 -102.721 -102.657 -102.598 -102.543 -102.494 -102.45 -102.412 -102.379 -102.353 -101.416 -101.334 -101.255 -101.18 -101.11 -101.044 -100.982 -100.925 -100.873 -100.826 -100.784 -99.981 -99.889 -99.8 -99.715 -99.633 -99.555 -99.481 -99.411 -99.346 -99.284 -99.228 -98.557 -98.455 -98.357 -98.261 -98.168 -98.078 -97.992 -97.909 -97.83 -97.755 -97.684 -97.144 -97.033 -96.924 -96.818 -96.715 -96.613 -96.515 -96.42 -96.327 -96.238 -96.152 -95.743 -95.623 -95.504 -95.388 -95.273 -95.161 -95.051 -94.943 -94.837 -94.733 -94.633 -94.353 -94.224 -94.096 -93.97 -93.845 -93.721 -93.599 -93.478 -93.359 -93.242 -93.127]
y = [0.034 -0.003 0.031 0.0 0.027 0.004 0.023 0.008 0.02 0.012 0.016 0.035 0.031 0.028 0.024 -0.003 0.02 0.016 0.001 0.013 0.005 0.009 0.036 0.032 0.028 0.025 0.021 0.017 0.013 0.01 -0.002 0.006 0.002 0.037 0.033 0.029 0.026 0.022 0.018 0.014 0.01 0.007 0.003 -0.001 0.037 0.034 0.03 0.026 0.023 0.019 0.015 0.011 0.007 0.003 -0.0 0.038 0.035 0.031 0.027 0.023 0.02 0.016 0.012 0.008 0.004 0.0 0.039 0.035 0.032 0.028 0.024 0.02 0.017 0.013 0.009 0.005 0.001 0.04 0.036 0.032 0.029 0.025 0.021 0.017 0.014 0.01 0.006 0.002 0.041 0.037 0.033 0.03 0.026 0.022 0.018 0.014 0.011 0.007 0.003 0.041 0.038 0.034 0.03 0.027 0.023 0.019 0.015 0.011 0.008 0.004 0.042 0.039 0.035 0.031 0.028 0.024 0.02 0.016 0.012 0.008 0.005]
z = [-868.98181753 -869.03656771 -869.00509484 -869.04789749 -869.02312937 -869.05456316 -869.03633374 -869.05691311 -869.04545933 -869.05571162 -869.0516303 -868.9851162 -869.00814308 -869.02572477 -869.03837956 -869.03783079 -869.04690268 -869.052603 -869.04921017 -869.05666944 -869.05589316 -869.05819117 -868.98833862 -869.01094443 -869.02795695 -869.04004859 -869.04791168 -869.05300034 -869.0571638 -869.05889077 -869.03849659 -869.05665363 -869.04993744 -868.99135258 -869.0134021 -869.02987311 -869.04137699 -869.04853356 -869.05287429 -869.05733 -869.05927447 -869.05702861 -869.05025941 -869.0387455 -868.99418691 -869.01558818 -869.0314407 -869.04237632 -869.04885431 -869.05217803 -869.05732872 -869.05940833 -869.05710197 -869.05022895 -869.03861199 -868.99666945 -869.01737986 -869.03274665 -869.04315341 -869.04910188 -869.05094408 -869.05733703 -869.05931497 -869.05685168 -869.04983308 -869.03810889 -868.99897704 -869.01895679 -869.03367205 -869.04362787 -869.04933318 -869.05243749 -869.05738309 -869.05890597 -869.05626901 -869.04905847 -869.03722417 -869.00101379 -869.02022918 -869.03437482 -869.04397026 -869.04968638 -869.05350931 -869.05745965 -869.05847175 -869.05539754 -869.04787576 -869.03585189 -869.00273423 -869.0211671 -869.03476459 -869.04409116 -869.04993815 -869.05406865 -869.05730611 -869.05770149 -869.05423116 -869.04651483 -869.03430857 -869.0041773 -869.0217949 -869.03486759 -869.04393834 -869.04990448 -869.05411243 -869.05676928 -869.05659592 -869.05271983 -869.04471149 -869.03232427 -869.00529229 -869.02209147 -869.03464015 -869.04350052 -869.04951656 -869.05362124 -869.05579053 -869.05509436 -869.05082327 -869.04252703 -869.02988852]
xg = linspace(min(x), max(x), 100);
yg = linspace(min(y), max(y), 100);
[Xg, Yg] = meshgrid(xg, yg);
Zg = griddata(x, y, z, Xg, Yg);
s = surf(Xg, Yg, Zg);

Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!