| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Spline Toolbox |
| Contents | Index |
| Learn more about Spline Toolbox |
Here are some operations you can perform on a piecewise-polynomial.
v = fnval(pp,x) | Evaluates |
dpp = fnder(pp) | Differentiates |
dirpp = fndir(pp,dir) | Differentiates in the direction dir |
ipp = fnint(pp) | Integrates |
fnmin(pp,[a,b]) | Finds the minimum value in given interval |
fnzeros(pp,[a,b]) | Finds the zeros in the given interval |
pj = fnbrk(pp,j) | Pulls out the jth polynomial piece |
pc = fnbrk(pp,[a b]) | |
po = fnxtr(pp,order) | Extends outside its basic interval by polynomial of specified order |
fnplt(pp,[a,b]) | Plots on given interval |
sp = fn2fm(pp,'B-') | Converts to B-form |
pr = fnrfn(pp,morebreaks) | Inserts additional breaks |
Inserting additional breaks comes in handy when one wants to add two piecewise-polynomials with different breaks, as is done in the command fncmb.
To illustrate the use of some of these commands, here is a plot of the particular piecewise-polynomial we just made up. First, the basic plot:
x = linspace(-5.5,-.5,101); plot(x, fnval(pp,x),'x')
Then add to the plot the breaklines:
breaks=fnbrk(pp,'b'); yy=axis; hold on for j=1:fnbrk(pp,'l')+1 plot(breaks([j j]),yy(3:4)) end
Finally, superimpose on that plot the plot of the polynomial that supplies the third polynomial piece:
plot(x,fnval(fnbrk(pp,3),x),'linew',1.3) set(gca,'ylim',[-60 -10]), hold off
A Piecewise-Polynomial Function, Its Breaks, and the Polynomial Giving Its Third Piece

The figure above is the final picture. It shows the piecewise-polynomial as a sequence of points and, solidly on top of it, the polynomial from which its third polynomial piece is taken. It is quite noticeable that the value of a piecewise-polynomial at a break is its limit from the right, and that the value of the piecewise-polynomial outside its basic interval is obtained by extending its leftmost, respectively its rightmost, polynomial piece.
While the ppform of a piecewise-polynomial is efficient for evaluation, the construction of a piecewise-polynomial from some data is usually more efficiently handled by determining first its B-form, i.e., its representation as a linear combination of B-splines.
![]() | Construction | The B-form | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |