3d plot with surface

14 Ansichten (letzte 30 Tage)
Naftalie Rianty
Naftalie Rianty am 24 Jul. 2019
Beantwortet: Walter Roberson am 24 Jul. 2019
so i have x,y,z coordinates like this
[701853.620,9309969.784,18.350;701853.666,9309969.286,18.350;701850.380,9309968.984,18.350;701850.732,9309969.519,18.350;701850.709,9309969.494,19.903;701851.294,9309969.56,19.861;701851.981,9309969.629,19.88;701852.715,9309969.703,19.919;701853.445,9309969.778,19.841;701853.444,9309969.771,20.958;701852.714,9309969.702,20.93;701851.979,9309969.624,20.896;701851.29,9309969.552,20.906;701850.706,9309969.489,20.36;701850.704,9309969.485,20.934;701851.288,9309969.546,22.421;701851.979,9309969.623,22.372;701852.715,9309969.706,22.336;701853.446,9309969.78,22.388;701853.620,9309969.784,22.950;701853.666,9309969.286,22.950;701850.380,9309968.984,22.950;701850.732,9309969.519,22.950]
when i scatter3 these coordinates the result is on the photo, i want to make a surface the same with the coordinates using scatter function. so i use this script
[Uxy,iaxy,icxy] = unique([x;y]','rows');
x = Uxy(:,1);
y = Uxy(:,2);
z = z(iaxy)';
xv = linspace(min(x),max(x),500);
yv = linspace(min(y),max(y),500);
[X,Y] = meshgrid(xv,yv);
Z = griddata(x,y,z,X,Y);
surf(X,Y,Z)
zlim([0,max(Z(:))])
shading('interp')
view(35,10)
but the result is not same with the scatter function. anyone can help? thanks

Antworten (1)

Walter Roberson
Walter Roberson am 24 Jul. 2019
You have points with duplicate x y . When you do that unique on x y pairs, you are losing the input from some of the points.
I would say that there is no reasonable surface for that set of points -- not unless you know more about continuity of the points.
Perhaps you should look into using boundary() and creating patches.

Community Treasure Hunt

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

Start Hunting!

Translated by