Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pchip coefficients: what do they mean?

118 views
Skip to first unread message

Jim Rockford

unread,
Apr 4, 2013, 1:54:45 AM4/4/13
to
I would like to be able to use the output coefficients from pchip to do various things, such as estimate the derivative at a point. This is easy enough to do with spline, since one knows that the coefficients correspond to a generic cubic polynomial in each subinterval. You can differentiate the cubic analytically and proceed, and it's clear what the coefficients mean.

However, I see absolutely nothing in the documentation indicating precisely what the "basis functions" are associated with the cubic Hermite interpolant. I suppose this is standard, but I wouldn't know it from the Matlab documentation. I know there are two references cited, but that's a bit much to go through in my opinion for such a simple piece of information, which I think should just be spelled out in a couple of lines in the help for pchip.

So, where can I find this information?

Thanks,
Jim

Torsten

unread,
Apr 4, 2013, 3:19:06 AM4/4/13
to
Jim Rockford <jim.ro...@gmail.com> wrote in message <378b90cd-e501-4444...@googlegroups.com>...
If you have access to the spline toolbox, you can use "fnder" to find the
dorder'th derivative:

f = pchip(t,y);
fprime=fnder(f,dorder);

Take a look at John D'Errico's contribution under
http://www.mathworks.com/matlabcentral/newsreader/view_thread/275252

Best wishes
Torsten.

Jim Rockford

unread,
Apr 5, 2013, 8:26:30 PM4/5/13
to Torsten
Thank you Torsten. I wasn't aware of "fnder" and will implement it in the future. I did find the information I sought about the pchip output structure in Mohler's book "Numerical Computing in Matlab" from 2004. For the sake of newsgroup posterity I'll summarize the relevant details here.

Over the kth subinterval [x(k),x(k+1)] the piecewise cubic Hermite polynomial constructed by pchip has the form

pk(x) = y(k) + d(k)*(x-x(k)) + c(k)*(x-x(k))^2 + b(k)*(x-x(k))^3

where the input data to be interpolated is given by the pairs (x(k),y(k)).

Using the Matlab command

>> pp = pchip(x,y)

returns the piecewise polynomial structure pp. The coefficients for pk(x) are given by the structure field pp.coefs, for which the kth row is

[b(k) c(k) d(k) y(k)]


In my opinion the pchip documentation would benefit from a couple of lines to the effect of what I've written above.

Best,
Jim

Bruno Luong

unread,
Apr 6, 2013, 4:35:07 AM4/6/13
to
See also:
http://www.mathworks.nl/matlabcentral/newsreader/view_thread/302815

I have explained there the content of pp structure (used not ONLY for pchip).

Bruno

John Mellor

unread,
Apr 6, 2013, 7:16:07 PM4/6/13
to
That's a good explanation, thanks. However, I still think much would
be gained in the documentation of the pp structures for the small
effort of a few lines of explanation. All one really needs to know is
the analytic form of the polynomial for each type of structure
(spline, cubic Hermite, B spline, etc) and how the coefficients are
arranged in the .coefs field.

Jim

Bruno Luong

unread,
Apr 7, 2013, 1:43:11 AM4/7/13
to
John Mellor <john.me...@gmail.com> wrote in message <9cadb2be-ea61-40ca...@r7g2000vbw.googlegroups.com>...
All one really needs to know is
> the analytic form of the polynomial for each type of structure
> (spline, cubic Hermite, B spline, etc) and how the coefficients are
> arranged in the .coefs field.

Theye are all the same arrangement, and I just check, it is documented in the help of mkpp

Bruno

croux...@gmail.com

unread,
Oct 11, 2018, 12:17:39 PM10/11/18
to
Very helpfull, thanks a lot
0 new messages