This preview shows page 1. Sign up to view the full content.
Unformatted text preview: %pp = mkpp(breaks,coefs) builds a piecewise polynomial pp from its breaks %and coefficients. breaks is a vector of length L+1 with strictly increasing %elements which represent the start and end of each of L intervals. coefs is %an L-by-k matrix with each row coefs(i,:) containing the coefficients of %the terms, from highest to lowest exponent, of the order k polynomial on %the interval [breaks(i),breaks(i+1)]. T=pp.coefs; Coefs=[3*T(:,1),2*T(:,2),1*T(:,3)]; P=mkpp(pp.breaks,Coefs); %v = ppval(pp,xx) returns the value of the piecewise polynomial f, %contained in pp, at the entries of xx. gg2=ppval(z,P); fprintf('\nTrue derivative values=\n') fprintf('\n%5.4f\n\n',gg1,gg2); fprintf('\n%4.5f\n\nSpline fit derivative values=\n') fpri...
View Full Document
- Spring '09