Text archives Help
- From: Dana Brooks <brooks@ece.neu.edu>
- To: seg3d@sci.utah.edu
- Subject: [Seg3D] [Fwd: Re: Re: computing the spline in the Spline Tool]
- Date: Thu, 10 Dec 2009 13:07:58 -0500
somehow managed to reply to the wrong one here, the one that went just
to Ram'on instead of to the list.
Dana
-------- Original Message --------
Subject: Re: [Seg3D] Re: computing the spline in the Spline Tool
Date: Thu, 10 Dec 2009 13:06:04 -0500
From: Dana Brooks <brooks@ece.neu.edu>
Reply-To: brooks@ece.neu.edu
To: Ramón Casero Cañas <ramon.casero@comlab.ox.ac.uk>
References: <FFA70C60-C40A-4DE1-BEF2-D33B1C55489F@sci.utah.edu>
<4B0D8F2F.9020105@comlab.ox.ac.uk>
<AFBB7B6B-E80D-4AFA-8B0F-ED923C305D01@sci.utah.edu>
<
4B20F78D.4040806@comlab.ox.ac.uk> <
4B2112F9.7030602@ece.neu.edu>
<4B212831.3050805@comlab.ox.ac.uk>
Ramón, hi,
a couple quick points ... the 'cubic' argument invokes pchip, which is a
piecewise cubic Hermite interpolant that Mathworks calls
"shape-preserving". I have not looked through the detailed mathworks
information on this but I know (from teaching a relevant course!) that
there is a detailed explanation of how this interpolant works in Cleve
Moler's book that is available on-line
(
http://www.mathworks.com/moler/index_ncm.html). Basically the free
boundary conditions are imposed in a way that prevents the spline
extrema from going "outside" where the points lie ....
second, it seems to me looking quickly through the code that interp1 is
just an interface to various kinds of interpolants. The spine toolbox
has other ways to get to the same things --- so cscvn does the natural
spline, and csape gives you a choice of end conditions including both
period and not-a-knot ---and now that I check the documentation, it says
that cscvn calls csape .... (good software engineering practice,
re-using the same code :-) )
I'm not sure what the best way to implement this in our own (SCI) code
at this point, but I am sure you and Kristen can figure that out!
Dana
Ramón Casero Cañas wrote:
Dana Brooks wrote:
Ramón, hi,
first, to be clear, using interp1 with the 'cubic' input is not a
spline, it's a Hermite interpolation with a particular condition that
Mathworks seems to like. I think you know that but just want to be
sure it is clear.
Hi Dana,
Thanks for the clarification, although from the documentation, it
seems that 'cubic' means using piecewise cubic Hermite polynomials
[1], and I think the whole curve is usually called a 'cubic Hermite
spline' [2].
second, I believe that you are correct that the end conditions are
different. Combing through Matlab help and looking at the interp1
code, it seems that interp1 uses a non-a-knot end condition while
cscvn uses the natural (or periodic) end condition. I would guess
that it should not be too hard to modify our spline code so that it
can handle both types of end conditions, but that's easy for me to
say ....
Yes, I think you are right.
Maybe it would be convenient to eventually have a small library with
functions that provide the different end conditions, interpolants, etc.?
For the moment, I think we can be very happy with something that works
and is consistent with other implementations :) Even if the Spline
Tool is implemented with the cscvn() spline, it will be very easy to
add an option to the interface to choose between cscvn() and interp1()
behaviour.
[1]
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html
[2] http://en.wikipedia.org/wiki/Cubic_Hermite_spline
R.
- [Seg3D] [Fwd: Re: Re: computing the spline in the Spline Tool], Dana Brooks, 12/10/2009
Archive powered by MHonArc 2.6.16.