|
From: Philipp K. J. <ja...@ie...> - 2007-11-07 19:51:30
|
I just submitted a patch for dgrid3d to sourceforge.
Features:
- Fully backward compatible with the current version.
- "Thin Plate Splines" can now be chosen as run-time
option: 'set dgrid3d 30,30 splines'
- Five new smoothing kernels (gauss, cauchy, exp,
box, hann) which can be selected as part
of 'set dgrid3d'. For these kernels, the smoothing
"radius" can be selected as part of the
"set dgrid3d" command.
The patch also includes updates to gnuplot.doc.
Let me know what you think.
Best,
Ph.
On Sunday 21 October 2007 08:46, Philipp K. Janert wrote:
> I was just playing with dgrid3d, and had some
> difficulties getting rather "smooth" input data
> to come out "just right". So I looked into the
> implementation for dgrid3d and wanted to make
> a suggestion.
>
> Context:
> ======
> dgrid3d evaluates (possibly ungridded) input data
> and calculates a smooth approximation to it on a
> regular grid. The values assigned to each grid point
> are essentially weighted averages:
> sum_{all points} w_i * data_i
> The sum runs over all input data points, and the
> weight function w is essentially an inverse power
> of the distance between each data point and the
> current grid point:
> w = 1/dist**p for some integer p
>
> Problem:
> ======
> This particular choice of weight function has a few
> disadvantages:
> 1) for dist==0, it is undefined (requiring treatment
> as special case)
> 2) for dist > 0 but small, the weight can become
> arbitrarily large
> 3) for large p, each individual data point totally
> dominates all grid points within dist < 1, but
> is irrelevant once dist > 1, with an abrupt
> change in behaviour at dist=1 if p gets large.
> 4) no way to control the "radius of influence" or
> catchment area for data points
>
> Suggestion:
> ========
> I think it would be desirable to have a weight function
> with the following properties:
> 1) bounded
> 2) w( d=0 ) = 1
> 3) falling smoothly as d -> infty
> 4) have a parameter which smoothly controls the
> size of the "catchment radius".
>
> A Gaussian is the first thing that comes to mind.
>
> I have tried it and quite like the results. I have
> posted some example images comparing Gaussian
> weighting vs the power law weighting at:
> www.philipp-janert.com/gnuplot
>
> Optional:
> ======
> I have hijacked the "norm" parameter to
> control the width of the Gaussian. This is
> not ideal - a better solution would be to
> extend the dgrid3d option in such a way
> that it can take two float values (instead
> of an int), which can be used to scale the
> x- and y-distances independently.
>
> Attached, you will find a patch file (against
> CVS head) containing the changes to use
> a Gaussian instead of a power law. They
> do not include the "optional" feature
> mentioned above.
>
> Please let me know what you think. I have
> not prepared a patch to the documentation
> yet - I'd like to hear opinions on this
> suggestion first.
>
> Best,
>
> Ph.
|