problem with scatteredInterpolant: are there any limits?
이전 댓글 표시
the xyz data file consists out of 3157394 data triples like this:
417826.974 5333045.048 1636.000
417826.974 5333045.128 1682.000
417826.974 5333045.208 1744.000
417826.974 5333045.288 1753.000
417826.974 5333045.368 1674.000
417826.974 5333045.448 1689.000
with the key data:
min(x) = 417740; max(x) = 417870; min(y) = 4177412; max(y)= 5333100; min(z)= 0; max(z) = 11054;
length(x) = length(y) = length(z) = 3157394;
First, everything works fine using:
TT=readtable(FileNameNeu,'PreserveVariableNames',true,'NumHeaderLines',1);
x=table2array(TT(:,1));
y=table2array(TT(:,2));
z=table2array(TT(:,3));
scatter3(x,y,z,4,z,'.'); view(2); grid on; daspect([1 1 1]);
But when I try this:
F = scatteredInterpolant(x,y,z,'natural','none'); :
[X,Y] = meshgrid(min(x):0.5:max(x),min(y):0.5:max(y));
Z = F(X,Y);
then I receive the error:
Error using scatteredInterpolant
The coordinates of the input points must be finite values; Inf and NaN are not
permitted.
Error in FillGaps (line 44)
F = scatteredInterpolant(x,y,z,'natural','none'); % create the interpolant
But...there are no Inf's and NaN's in the data file.
The same occurs if I reduce the values of x and z using:
x=x-min(x); y=y-min(y);
What I am doing wrong? Thanks a lot,
Harry
댓글 수: 5
John D'Errico
2022년 11월 13일
It would so much help if you actually provided the data. Shifting the data, and still having a problem tells me the problem is not a numerical problem. However, it is still possible you have something inf or NaN in there, and you do not realize it.
Bruno Luong
2022년 11월 13일
The data cannot have -Inf or Inf since min and max are finites. However NaN is possible.
Steven Lord
2022년 11월 14일
Harald von der Osten
2022년 11월 14일
Harald von der Osten
2022년 11월 14일
채택된 답변
추가 답변 (1개)
Bruno Luong
2022년 11월 13일
1 개 추천
You'll have problem anyway since your data is not centered and especially not normalize.
x range is 130 and y range is 1155688, almost 10000 larger than xrange. Scattered interpolation is based on Delauray triangulation, and that alone will give garbage out.
I believe it written somewhere (tip) this warning in the doc page.
So please do CENTERING and NORMALIZATION data as preproceesing step before interpoltion.
카테고리
도움말 센터 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!