interpolation surface no mesh

조회 수: 3 (최근 30일)
Federico Maglione
Federico Maglione 2019년 10월 4일
답변: Naveen Venkata Krishnan 2019년 10월 9일
Hi all,
I am not very familiar with surfaces and I am having some problems with the built-in functions to interpolate/extrapolate over a surface.
My data is in the form
  • X vector of lenght a
  • Y vector of length b
  • Z matrix of size axb
X and Y do not have the same length (a~=b). I have attached an example of data
In order to interpolate over the surface and extrapolate outside the data points, which function should I use? griddata(x,y,v,xq,yq)? interp2(X,Y,V,Xq,Yq)? scatteredInterpolant(x,y,v)?
Also, could someone explain me in which format X and Y should be inputted given the selected function?
Thank you.
  댓글 수: 2
Stephen23
Stephen23 2019년 10월 4일
편집: Stephen23 2019년 10월 4일
"which function should I use?"
That partly depends on how you want to extrapolate: do you want:
  1. a constant value,
  2. to use either spline or makima interpolation,
  3. some other interpolation method?
If you want either 1. or 2. then you can simply use interp2 with your already gridded data.
You also did not explain the output data structure: should this also be gridded data, or do you want to interpolate at points that are not placed on a grid?
Federico Maglione
Federico Maglione 2019년 10월 4일
Hi Stephen,
thank you for your answer.
I need to interpolate/extrapolate for constant points. Given the surface what is the corresponding value of, say, the point of coordinates (0.5, 0.8)? both 0.5 and 0.8 however could be outside the available data points. Therefore I assume I could use interp2 as I need just linear interpolation.
The output needs just to be the value on the surface.

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

답변 (1개)

Naveen Venkata Krishnan
Naveen Venkata Krishnan 2019년 10월 9일
Hello,
I think you can use interp2 function
interp2(X,Y,Z,xq,yq) %interp2(X,Y,Z,0.5,0.8)
Where xq,yq are the query points where the values need to be calculated

카테고리

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