2D grid interpolation problem

조회 수: 3 (최근 30일)
Luke Blades
Luke Blades 2016년 4월 17일
댓글: Taindra Neupane 2020년 10월 1일
Hello,
I'm having trouble with 2d interpolation using interp2.
I have a grid of data, 200x200. I've plotted the surface and there are some values missing from my data set. I need to calculate the volume beneath this surface and to do that i need to get rid of any NaN values so the trapz function will work.
I've tried using interp2 but i get the error "Interpolation requires at least two sample points in each dimension."
There is no row or column in my data matrix which is composed entirely of NaN. Is it an issue if there are several NaN values in a row (does it interpolate between values 1 cell apart)?
Any help greatly appriciated, this is driving me nuts!
Many thanks,
Luke
  댓글 수: 1
Taindra Neupane
Taindra Neupane 2020년 10월 1일
Hello Friends,
I have a 2d uniformly gridded data (like an image or dose with specific voxel size), I am looking for interpolation funtion to divide into +ve interger as well as non-integer values like 1, 1.5,2....! I am using interpn (A,k) or interpn2 (A,k) but its interpolating only into even +ve intergers points/values like k=0, no interpolation, k=1, two values, k=2, 4 values as it divide into 2^k -1 values. So, I am wondering if I want to divide 3mmx3mm pixel into 1mmx1mm pixel (3 sections). Please help me on this.
Thanks in advance!

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

채택된 답변

Walter Roberson
Walter Roberson 2016년 4월 18일
Look in the File Exchange for John D'Errico's inpaint_nans
  댓글 수: 1
Luke Blades
Luke Blades 2016년 4월 18일
Perfect, works a treat. Thanks!

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

추가 답변 (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