File Exchange

image thumbnail

Local maxima and minima of a pp spline

version (2.02 KB) by Matthew Arthington
Determine the locations of local maxima and minima in a pp spline generated by pp = spline(x,Y);

1 Download

Updated 03 Jul 2010

View License

This function uses vectorised methods to determine the locations of maxima and minima where they exist within a piecewise spline fit. The matlab built-in functions for determining the maxima and minima, by differentiating the pp spline and finding its zeros (using the Spline toolbox), are quite slow, and are given as comment at the end of the m-file for reference.

Cite As

Matthew Arthington (2020). Local maxima and minima of a pp spline (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)


Much faster than fnmin -- exactly what I was looking for. Thanks a lot!

Thomas Clark: Adjusted as suggested.

Actually I adjusted it a while ago, but I forgot to thank you - thanks.


Apologies - the code itself is actually spline toolbox independent - but the example code requires fnval, which can be directly replaced with ppval for non spline-toolbox users.

Suggest updating the example - I've updated my rating!



Tom Clark

The following link contains a short piece of code which makes this submission toolbox-independant (derivation of a pp).

Kind regards



Altered the example code so that it is also toolbox independent.

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux