MATLAB Answers

how can I interpolate?

5 views (last 30 days)
jack nn
jack nn on 18 May 2016
Commented: Walter Roberson on 20 May 2016
hi all. I have some data and I want to interpolate z in this data. I used this code:
% year2012=xlsread('year2012');
z = interp2(X,Y,Z,x,y);
but I have this error :
% Error using griddedInterpolant
The coordinates of the input points must be finite values; Inf and NaN are not permitted.
Error in interp2>makegriddedinterp (line 228)
F = griddedInterpolant(varargin{:});
Error in interp2 (line 128)
F = makegriddedinterp({X, Y}, V, method,extrap);
Error in new (line 19)
z = interp2(X,Y,Z,x,y,'nearest');code
I attached my data and I think my data is true. can you please guide me?


per isakson
per isakson on 18 May 2016
jack nn
jack nn on 19 May 2016
thanks dear Isakson. I just used 1:91 in my code.

Sign in to comment.

Answers (1)

Andrei Bobrov
Andrei Bobrov on 18 May 2016
F = scatteredInterpolant(X,Y,Z);
out = F(x,y);


Show 3 older comments
Walter Roberson
Walter Roberson on 20 May 2016
Like Andrei posted, F = scatteredInterpolant(X,Y,Z);
jack nn
jack nn on 20 May 2016
thanks, dear Walter Roberson. Can I ask an other question?
Walter Roberson
Walter Roberson on 20 May 2016
Go ahead and create another Question.

Sign in to comment.

Sign in to answer this question.