2D Interpolation of a scatterplot using xyz values.

조회 수: 8 (최근 30일)
Quinn Coughlin
Quinn Coughlin 2021년 3월 9일
댓글: Star Strider 2021년 3월 9일
I have a 2d scatter plot that I need to interpolate. The values are from an excel sheet and it is a matrix of 3 columns. The first column is the x coordiante, the second is the y coordiante and the third column is the z coordinate. How would I interpolate these data sets on to a 2d scatter plot.
Thanks for the help.

답변 (1개)

Star Strider
Star Strider 2021년 3월 9일
There are several options, likely the easiest being:
xv = linspace(min(x), max(x), numel(x));
yv = linspace(min(y), max(y), numel(y));
[X,Y] = ndgrid(xv,yv);
Z = griddata(x, y, z, X, Y);
That will create a uniform grid in ‘Z’ that interpolates the original ‘z’ values and can then be plotted as desired.
  댓글 수: 2
Quinn Coughlin
Quinn Coughlin 2021년 3월 9일
Hi thanks for the help, I keep on getting this error, Warning: The underlying triangulation is empty - the points may be collinear. How can i fix this?
Star Strider
Star Strider 2021년 3월 9일
My pleasure!
How can i fix this?
I cannot determine that without your data. Using the unique function with the 'rows' argument may be a solution, however I cannot determine that with any certainty.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by