"Input grid is not a valid MESHGRID." matlab interp2

조회 수: 12 (최근 30일)
Wenjuan
Wenjuan 2016년 11월 11일
댓글: Guillaume 2016년 11월 11일
I am trying to run the following code oz = interp2(ix,iy,iz,ox,oy); ix, iy, iz are 2048 x 2048 matrix ix and iy are grid data ox, oy are 4098 x 4098 matrix, generated by meshgrid funcion, and are within the data range of ix and iy.
however, the software can't work it out and showed error message"Input grid is not a valid MESHGRID" I am not sure where went wrong. I would like to upload the data here, but the file is quite big.
the matlab version is R2016a

답변 (1개)

Guillaume
Guillaume 2016년 11월 11일
The problem is not your ox and oy (which don't even have to be gridded), but your ix and iy which need to be the vertices of a grid (with no holes).
If the known points don't lie on a regular grid, then you can use scatteredInterpolant instead
interpolant = scatteredInterpolant(ix, ix, yz);
oz = interpolant(ox, oy);
  댓글 수: 1
Guillaume
Guillaume 2016년 11월 11일
wenjuan's comment moved here
Thanks. It seems the case. Though the data ix iy should be grid, but may not accurate.

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

카테고리

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