How to find f(x) using data interpolated using cubic spline interpolation

1 view (last 30 days)
I have a set of values, x and y (f(x)), in a tabular form. I have used cubic spline interpolation to fit the data. i got the coefficients of the cubic spline interpolation for the interval [x0, xn]. How can i find the total equation of the function f(x) using the coefficients. Instead of finding cubic spline s(x) for a single interval, i need to find out the function for the whole interval. Like in polynomial interpolation, p(x)=p1x3+p2x2+p3x+p4,. The equations i have used in given below. Please help me on this.
The spline function s(x) on the interval [xl, xr] is defined by
s(x) = a0 + a1*(x-xl) + a2*(x-xl)^2 + a3*(x-xl)^3
With x in the interval [xl , xr].
For example, s (x) is defined in the interval [0, 0.0461], with coefficients a3=0.4891, a2=-0.09, a1=0.003 and a0=0.02, by the expression s(x) = 0.02+ 0.0031*(x-0) - 0.09*( x-0)^2 + 0.4891*( x-0)^3 s' (x) = 0.0031-0.1824*x+1.4673*x^2 s'' (x) = -0.1824 +2.9346*x Substituting the values s (0)= 0.02, s'(0)= 0.0031, s''(0)= -0.1824 s (0.0461)= 0.02, s'(0.0461)= -0.0022, s''(0.0461)= -0.0471

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!