How can I fit spline and extrapolate the fitting beyond my data set?

Hi all, Suppose x=[1:10]; y=sin(x); Now I want to use splinefit/shape-preserving-spline-interpolation (instead of spline) over the data set. Now I want to get the values of y at x=[0.05:30] according to the fitting. How can I do that job? Many thanks in advance. Eagerly awaiting for your reply.
Regards, Kaushik

1 Comment

Why would you want to do that? If you use a cubic spline, you'll be extrapolating the last cubic - the one that's only valid just from 9.95 to 10.0. And the cubic evaluated out at 30 will be nowhere close to what the sin evaluated at 30 would be.

Sign in to comment.

Answers (1)

interp1(1:10, sin(1:10), [.05:30],'pchip','extrap');

Tags

Asked:

on 2 Mar 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!