MATLAB Answers

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

8 views (last 30 days)
LB on 2 Oct 2019
Commented: LB on 3 Oct 2019
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?


Show 7 older comments
LB on 2 Oct 2019
It was showing up as a comment/text line
I fixed the code above for those variables
Walter Roberson
Walter Roberson on 2 Oct 2019
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);
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 =
>> 6400*2*pi/60
ans =
Your probe x is outside the range of any of the data you define.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 2 Oct 2019
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.


Sign in to comment.

More Answers (0)