1D to 2D interpolation

조회 수: 10 (최근 30일)
maubars
maubars 2020년 10월 14일
댓글: maubars 2020년 10월 14일
I would like to know how griddata operate. I would like to scatter 2D points to a 3D grid using the griddata interpolate. The code which brings some errors.
x=1:1:10;
y=11:1:20;
z= sqrt(x.^2+y.^2)
[xx,yy] = meshgrid(linspace(min(x),max(x),200),linspace(min(y),max(y),200))
zz=griddata(x,y,z,xx,yy,'nearest')
The error is as seen below.
Warning: The underlying triangulation is empty - the points may be collinear.
> In griddata>useScatteredInterp (line 183)
In griddata (line 120)
zz =
[]

채택된 답변

Matt J
Matt J 2020년 10월 14일
편집: Matt J 2020년 10월 14일
In order for griddata to work meaningfully, the points xx,yy where you want to interpolate must be surrounded by scattered data points x,y (that's what "interpolation" means). Here, you have it the other way around.

추가 답변 (0개)

카테고리

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