problem with scatteredInterpolant: are there any limits?
Mostrar comentarios más antiguos
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 comentarios
John D'Errico
el 13 de Nov. de 2022
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
el 13 de Nov. de 2022
The data cannot have -Inf or Inf since min and max are finites. However NaN is possible.
Steven Lord
el 14 de Nov. de 2022
Harald von der Osten
el 14 de Nov. de 2022
Harald von der Osten
el 14 de Nov. de 2022
Respuesta aceptada
Más respuestas (1)
Bruno Luong
el 13 de Nov. de 2022
1 voto
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.
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!