Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
pchip coefficients: what do they mean?

Subject: pchip coefficients: what do they mean?

From: Jim Rockford

Date: 4 Apr, 2013 05:54:45

Message: 1 of 6

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

Subject: pchip coefficients: what do they mean?

From: Torsten

Date: 4 Apr, 2013 07:19:06

Message: 2 of 6

Jim Rockford <jim.rockford1@gmail.com> wrote in message <378b90cd-e501-4444-a6d0-92dc24847e95@googlegroups.com>...
> 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

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.

Subject: pchip coefficients: what do they mean?

From: Jim Rockford

Date: 6 Apr, 2013 00:26:30

Message: 3 of 6

On Thursday, April 4, 2013 3:19:06 AM UTC-4, Torsten wrote:
> Jim Rockford <jim.rockford1@gmail.com> wrote in message <378b90cd-e501-4444-a6d0-92dc24847e95@googlegroups.com>...
>
> > 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
>
>
>
> 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.



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

Subject: pchip coefficients: what do they mean?

From: Bruno Luong

Date: 6 Apr, 2013 08:35:07

Message: 4 of 6

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

Subject: pchip coefficients: what do they mean?

From: John Mellor

Date: 6 Apr, 2013 23:16:07

Message: 5 of 6

On Apr 6, 4:35am, "Bruno Luong" <b.lu...@fogale.findmycountry> wrote:
> See also:http://www.mathworks.nl/matlabcentral/newsreader/view_thread/302815
>
> I have explained there the content of pp structure (used not ONLY forpchip).
>
> Bruno

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

Subject: pchip coefficients: what do they mean?

From: Bruno Luong

Date: 7 Apr, 2013 05:43:11

Message: 6 of 6

John Mellor <john.mellor166@gmail.com> wrote in message <9cadb2be-ea61-40ca-bfdd-1728fca89dba@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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us