- Obviously you can think about starting from surface 2 to match the x and y of surface 1. The difference in the result should be negligible, but this depends on the data.
- I would suggest another measure of the distance, because you can imagine that if the two surfaces cross each other you could have a distance of zero, when actually is not. I would square the difference vector and take its square root as a first attempt.
Compare two matrices/meshgrid/surface/ model digital - distance between models - point data - 3D mesh
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Octavian Macari
il 23 Mag 2018
Commentato: Nicola Bombace
il 29 Mag 2018
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190774/image.jpeg)
<<
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190775/image.jpeg)
>>
I have 3 vectors fo each surface (meshgrid). I want to compare the distance between this to surfaces. The problem is that to surfaces are not in the same position and the cells of the meshgrid are not on the same size. What i can do to obtain the correct distance between of this tow models?
surf(X,Y,Z); hold on; grid on; hold on, scatter3(NF_P(:,1),NF_P(:,2),NF_P(:,3),'filled'); surfl(X2A,Y2A,Z2A); hold on; scatter3(DD_B2(:,1),DD_B2(:,2),DD_B2(:,3)*(-1),'filled')
i want the difrence between Z and Z2A, but X and Y are difrent from X2A and Y2A.
i make Z3=Z-Z2A, bu is not correct that giv me difrences of 4 meters , that is not true, soo i dont know how to make this analyse
0 Commenti
Risposta accettata
Nicola Bombace
il 23 Mag 2018
Modificato: Nicola Bombace
il 23 Mag 2018
The first thing you want to do is interpolate the data from one surface to be at the x,y position of the second surface. Then compute the distance from the interpolated surface
Z_int = griddata(X,Y,Z,X2A,Y2A); %interpolate surface 1 to match x,y coordinates of surface 2
Z3 = Z_int - Z2A;
Just two more comments
Hope this helps
6 Commenti
Nicola Bombace
il 29 Mag 2018
The issue of cleaning the points is not trivial. I can suggest an algorithm, rather than a specific implementation, and hopefully it will be easy to implement.
- Construct the Mesh with the original points using the delaunayn function
- Determine if a query point is inside your delaunay triangulation using pointLocation function
Più risposte (1)
Octavian Macari
il 27 Mag 2018
1 Commento
Nicola Bombace
il 29 Mag 2018
If you were to use the code above (the second comment), you could just do:
distMeasure = sqrt(norm(diff));
This will give you a single number that measures the distance of the two surfaces.
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!