{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

moresplines - pause%Cubic spline with zero-slope clamped...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function moresplines(x,y) %Problem 16.5 %Fit data with a cubic spline with not-a-knot end conditions %v = ppval(pp,xx) returns the value of the piecewise polynomial f, %contained in pp, at the entries of xx. %pp = spline(x,Y) returns the piecewise polynomial form of the cubic spline %interpolant for later use with ppval and the spline utility unmkpp. x must %be a vector. gg=linspace(min(x),max(x),101); yy=interp1(x,y,gg,'spline'); plot(x,y,'o',gg,yy); title('(a) Cubic spline with a not-a-knot end condtions'); xlabel('x'); ylabel('f(x)');
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pause %-------------------------------------------------------%Cubic spline with zero-slope clamped end conditions y2=[0 0 0 0 1 1 1 0]'; pp=spline(x,y2); yy=ppval(pp,gg); plot(x,y,'o',gg,yy); title('(b) Cubic spline with zero-slope clamped end condtions'); xlabel('x'); ylabel('f(x)'); pause %-------------------------------------------------------%Piecewise cubic hermite interpolation yy=interp1(x,y,gg,'pchip'); plot(x,y,'o',gg,yy); title('(c) Piecewise cubic hermite interpolation'); xlabel('x'); ylabel('f(x)');...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online