How to interpolate ‘z’ for one value of ‘x’ but multiple values of y?

조회 수: 4 (최근 30일)
JD
JD 2019년 10월 2일
댓글: JD 2019년 10월 3일
I have an array x of size 1x56 An array y of size 1x20 And an array z of size (20x56)
I want to interpolate to find ‘z’ for a specific value of x but multiple y.
I am trying to plot Interp2(x,y,z,1400,y)
Z =f(x,y,z)
But it doesn’t seem to be working right. Anyone have any ideas?
  댓글 수: 10
Walter Roberson
Walter Roberson 2019년 10월 2일
Error using griddedInterpolant
The grid vectors do not define a grid of points that match the given values.
That is reported inside interp2(). The fix for that is to change
mfdot_6400 = interp2(ICE.map_w,ICE.map_T,mfdot_6400c',6400*2*pi/60,ICE.map_T);
to
mfdot_6400 = interp2(ICE.map_w,ICE.map_T,mfdot_6400c,6400*2*pi/60,ICE.map_T);
That is, remove the complex conjugate transpose.
However you will still get NaN. And that is because:
>> max(ICE.map_w)
ans =
664.97044500984
>> 6400*2*pi/60
ans =
670.206432765823
Your probe x is outside the range of any of the data you define.
JD
JD 2019년 10월 3일
That makes sense, thank you both for the help!

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

채택된 답변

Matt J
Matt J 2019년 10월 2일
If an interpolation result is giving you NaN, it normally means you are interpolating at a location which is outside the area covered by your points - hence there is no data there to interpolate between.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Equations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by