Is griddedinterpolant omits NaN?
16 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
darova
2020 年 3 月 27 日
You can find out by yourself
[X,Y] = meshgrid(0:10);
Z = 0*X;
Z(5:7,5:7) = nan;
surf(X,Y,Z,'edgecolor','none')
[X1,Y1] = meshgrid(0:0.4:10);
Z1 = griddata(X,Y,Z,X1,Y1);
hold on
surf(X1,Y1,Z1,'facecolor','none')
hold off
1 件のコメント
Andrey Yatsunenko
2024 年 12 月 1 日
I'm afraid the answer is incorrect.
Griddata is not a close relative to the griddedInterpolant; griddata (despite its name) deals with scattered data, and only up to 3 dimentions.
その他の回答 (1 件)
Stephen23
2024 年 12 月 2 日
編集済み: Stephen23
2024 年 12 月 2 日
NaN values will propagate from input to output, just as they should in any mathematical calculation.
x = sort(20*rand(100,1));
v = besselj(0,x);
v(23:50) = NaN; % modified
F = griddedInterpolant(x,v)
xq = linspace(0,20,500);
vq = F(xq);
plot(x,v,'ro')
hold on
plot(xq,vq,'.')
legend('Sample Points','Interpolated Values')
If you want to remove NaNs from data then you will need to either:
- pre-process the data to remove the NaNs yourself, or
- use high-level convenience functions e.g. FILLMISSING.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!