Problem with interpolation



When I run the following code error is generating

fid = fopen('xyz.txt', 'r');
A = fscanf(fid, ['%d' '%d' '%f']);
s = size(A);
q = max(s);
w = 1;
for i = 1:3:q
x(w) = A(i);
w = w +1;
end
w=1;
for i = 2:3:q
y(w) = A(i);
w = w +1;
end
w=1;
for i = 3:3:q
z(w) =40-39 * A(i);
if(z(w)>10)
z(w) = 5.0;
end
w = w +1;
end

xres=30;
yres=37;

xmin = min(x); ymin = min(y);
xmax = max(x); ymax = max(y);

yv = linspace(xmin, xmax, yres);
xv = linspace(ymin, ymax, xres);
%X = [0 0; 0 1e-10; 0 0; 1 1];

%K = convhulln(X,{'Qt','Pp'});

[Xinterp,Yinterp] = meshgrid(yv,xv);

Zinterp = griddata(x,y,z,Xinterp,Yinterp);

figure
mesh(Xinterp,Yinterp,Zinterp)
colormap(cool(8))


xlabel X; ylabel Y; zlabel Z;

Error which I got is

??? qhull precision warning:
The initial hull is narrow (cosine of min. angle is
1.0000000000000000).
A coplanar point may lead to a wide facet. Options 'QbB'
(scale to unit box)
or 'Qbb' (scale last coordinate) may remove this warning.
Use 'Pp' to skip
this warning. See 'Limitations' in
http://www.qhull.org/html/qh-impre.htm

qhull precision error: initial simplex is not convex.
Distance=-7.1e-015


While executing: | qhull d Qt Qbb Qc

Options selected for Qhull 2003.1 2003/12/30:
delaunay Qtriangulate Qbbound-last Qcoplanar-keep
_pre-merge
_zero-centrum Pgood Qinterior-keep _max-width 1.4e+002
Error-roundoff 2.9e-013 _one-merge 2e-012 Visible-
distance 5.7e-013
U-coplanar-distance 5.7e-013 Width-outside 1.1e-012
_wide-facet 3.4e-012
_narrow-hull 0


The input to qhull appears to be less than 3 dimensional,
or a
computation has overflowed.

Qhull could not construct a clearly convex simplex from
points:


The center point is coplanar with a facet, or a vertex is
coplanar
with a neighboring facet. The maximum round off error for
computing distances is 2.9e-013. The center point, facets
and distances
to the center point are as follows:




facet
p135
p16592
p0
distance= -7.1e-015

facet
p16727
p16592
p0
distance= -1.4e-014

facet
p16727
p135
p0
distance= -7.1e-015

facet
p16727
p135
p16592
distance= -7.1e-015


These points either have a maximum or minimum x-coordinate,
or
they maximize the determinant for k coordinates. Trial
points
are first selected from points that maximize a coordinate.


The min and max coordinates for each dimension are:

0: 65 187 difference= 122

1: 72 207 difference= 135

2: 0 135 difference= 135


If the input should be full dimensional, you have several
options that
may determine an initial simplex:
- use 'QJ' to joggle the input and make it full
dimensional
- use 'QbB' to scale the points to the unit cube
- use 'QR0' to randomly rotate the input for different
maximum points
- use 'Qs' to search all points for the initial simplex
- use 'En' to specify a maximum roundoff error less than
2.9e-013.
- trace execution with 'T3' to see the determinant for
each point.

If the input is lower dimensional:
- use 'QJ' to joggle the input and make it full
dimensional
- use 'Qbk:0Bk:0' to delete coordinate k from the input.
You should
pick the coordinate with the least range. The hull
will have the
correct topology.
- determine the flat containing the points, rotate the
points
into a coordinate plane, and delete the other
coordinates.
- add one or more points to make the input full
dimensional.



This is a Delaunay triangulation and the input is co-
circular or co-spherical:
- use 'Qz' to add a point "at infinity" (i.e., above the
paraboloid)
- or use 'QJ' to joggle the input and avoid co-circular
data



Error in ==> delaunayn at 81
t = qhullmx(x', 'd ', opt);

Error in ==> griddata>linear at 140
tri = delaunayn([x y]);

Error in ==> griddata at 109
zi = linear(x,y,z,xi,yi,opt);

Error in ==> Interpolation at 70
Zinterp = griddata(x,y,z,Xinterp,Yinterp);

Can Anybody help me out this. x,y and z are size 1 X 16728
.



Relevant Pages

  • Interpolation
    ... A coplanar point may lead to a wide facet. ... qhull precision error: ... distance 5.7e-013 ... The min and max coordinates for each dimension are: ...
    (comp.soft-sys.matlab)
  • error when using griddata
    ... ERRONEOUS FACET: ... | qhull d Qt Qbb Qc ... distance= -1.8e-015 ... The min and max coordinates for each dimension are: ...
    (comp.soft-sys.matlab)
  • Generating mesh from 3d point cloud?
    ... ERRONEOUS FACET: ... | qhull d Qt Qbb Qc ... distance= -2.8e-014 ... dimension are: ...
    (comp.soft-sys.matlab)
  • Re: griddata error: qhull precision error, ERRONEOUS FACET
    ... ERRONEOUS FACET: ... | qhull d Qt Qbb Qc ... distance= -3.6e-15 ... The min and max coordinates for each dimension are: ...
    (comp.soft-sys.matlab)
  • Re: meshgrid
    ... ERRONEOUS FACET: ... | qhull d Qt Qbb Qc ... distance= -2.8e-014 ... The min and max coordinates for each dimension are: ...
    (comp.soft-sys.matlab)