Interpolation between matrices (image attached)

조회 수: 2 (최근 30일)
Mahi Nazir
Mahi Nazir 2014년 2월 12일
댓글: Mahi Nazir 2014년 2월 12일
I need to do 4 way interpolation where I have the coordinates x1, y1 and a matrix z11 at those coordinates. I have the coordinates x2, y1 and a matrix z21 at those coordinates. I have the coordinates x1, y2 and a matrix z12 at those coordinates. I have the coordinates x2, y2 and a matrix z22 at those coordinates. I need to interpolate to get the MATRIX z for coordinates x and y.
Like in the image attached the matrices at (-4,0), (4,0), (-4,20) and (4, 20) are given. I need to interpolate to get the matrix values for position(0,10)
Can someone please guide me through this

채택된 답변

Oliver Woodford
Oliver Woodford 2014년 2월 12일
Your query location, (0,10), is in the center of your grid, so if you want a linear interpolation between the input matrices you'll just need to average them:
output = (z11 + z21 + z12 + z22) / 4;
  댓글 수: 1
Mahi Nazir
Mahi Nazir 2014년 2월 12일
I never thought it could be so simple. I was trying to use interp2 and couldn't get through it. Thank you so much. Cheers!

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

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