필터 지우기
필터 지우기

Difference between the griddata and the source data when creating contour

조회 수: 3 (최근 30일)
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

채택된 답변

Walter Roberson
Walter Roberson 2023년 10월 5일
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
Ali
Ali 2023년 10월 5일
Hello Walter,
Stephen proposed a solution but that will need reshape the data. What do you think that reshape the data can make the contour smoother?
Thanks
Walter Roberson
Walter Roberson 2023년 10월 5일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by