how can I interpolate?
显示 更早的评论
hi all. I have some data and I want to interpolate z in this data. I used this code:
% year2012=xlsread('year2012');
year2012=double(year2012);
X=year2012(1:91,1);
Y=year2012(1:91,2);
Z=year2012(1:91,3);
x=year2012(1:91,4);
y=year2012(1:91,5);
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?
回答(1 个)
Andrei Bobrov
2016-5-18
F = scatteredInterpolant(X,Y,Z);
out = F(x,y);
6 个评论
Walter Roberson
2016-5-19
zbar = F(xbar, ybar)
jack nn
2016-5-20
Walter Roberson
2016-5-20
Like Andrei posted, F = scatteredInterpolant(X,Y,Z);
jack nn
2016-5-20
Walter Roberson
2016-5-20
Go ahead and create another Question.
类别
在 帮助中心 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

