|
"Florian " <f.pappenberger@NOSPAMlancater.ac.uk> wrote in message
<f9c0vm$7ct$1@fred.mathworks.com>...
> Hello all,
>
> I want to do a simple nearest neighbour interpolation with
> out using griddata. Can some one help, please - delauney
> throughs errors (see below) and gives no triangulation.
>
> Example:
> x=[1 2.5 3 4.5];
> y=[1 2.5 3 4.5];
> z=[1 2 3 4];
>
> xi=[1.5 2.4];
> yi=[1.5 2.5];
>
> what is zi with nearest neighbour interpolation?
>
> Thanks,
> flo
>
>
> Error
>
> >> tri = delaunay(x,y,{'QJ' 'Qbb'});
> Warning: 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 qh-impre.htm.
Sigh.
Look at what you are trying to do. Its always
a good idea. Next, understand the tool that
you are trying to use.
You have placed 4 points in the x,y plane. Where
do they lie? Plot them. Note that for each x, the
value of y is equal to that x. PLOT THEM!!!!!!!
plot(x,y,'o')
grid on
Do they form a straight line?
Next, please draw on that plot exactly which
triangulation YOU would form. Remember, the
points fall on a straight line. Feel free to draw
any triangles that you want, as long as the
triangle vertices come from this list of 4 data
points. Feel free to find some non-degnerate
triangles composed of vertices from your data.
A triangle that is degenerate would have zero
area. Triangles with collinear vertices are good
examples of degenerate triangles.
Why are degenerate triangles bad for interpolation?
While obviously, anything that is degenerate must
be BAD TO THE BONE, it turns out that interpolation
inside zero area triangles involves a singularity.
Plus, delaunay has problems of its own, because
IT too cannot decide how to triangulate your data.
I know, griddata should be smart enough to know
that what you are trying to do is not a good thing
to do. Yes, it might decide that even though you
have told it to form a triangulation of this data,
that it could just build a model of z(x), since there
is no additional information in the variable y. But
sadly, griddata is just a lowly, underpaid, working
stiff of a computer program. It tries to do only
what it is designed to do, and no more.
Always think about what you are doing. Understand
the tools that you use. Otherwise you should expect
to see randomly meaningless results.
John
|