Difference between the griddata and the source data when creating contour
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ali
el 4 de Oct. de 2023
Comentada: Walter Roberson
el 5 de Oct. de 2023
Hello,
I have some random scatter data in X, Y Z format and would like to create the contour based on them. The data are processed using the meshgrid and griddata method. After comparing the contour and the source data, the contour level line is not matching the source data.
In the figure below, you can see the source data plotted against the contour. The scource data values are actually known for each line, like the marked 30, 29, 28. I was expecting the contour level line should match the line drawn by the source data.
I tried different interpolation method and the linear method give the best results as shown below.
Any suggestions to solve this problem?
Thanks
0 comentarios
Respuesta aceptada
Walter Roberson
el 5 de Oct. de 2023
griddata() is based upon first triangulating the input points (unless 'v4' method is specified). triangulation of sparse 3D surfaces can give unexpected results. It is common for long thin triangulations between distant points to end up being created.
The denser the sparse data, the more likely it is for the triangulation to "mostly" follow the known surface fairly well. But especially if the surface was sampled more closely in one dimension than another dimension, the triangulation can end up fairly odd.
If you know something about the distribution of sample points, it can at times be better if you construct your own triangulation before doing the interpolation. But a lot of the time you do not know anything about the distribution, and you just have to live with the fact that what you get out is an approximation.
2 comentarios
Walter Roberson
el 5 de Oct. de 2023
In that particular question, @Stephen23 was replying for a situation in which the data followed a rectangular quasi-grid .
In the information you have given us so far, we do not know if that is what you have available for your samples. For example if you were more or less working with a "compressive sensing" situation, then you would not have a quasi-grid.
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!