How can I integrate a set of data that has been fit with a cubic spline interpolation?

28 visualizaciones (últimos 30 días)
I have a few sets of data and I am trying to apply a fitted curve to, which would then allow me to integrate the functions. I have learned how to do this with nearly all the fits (such as polynomial, Fourier, Gauss, etc.). However I've recently found out about the cubic spline interpolation, which produces a piece wise function. However I am running into issues as I do not have any idea how to integrate this. I've been trying for the past few hours to figure this out and I cant seem to make any progress:
Here is a sample of the code I'm working on:
A = csvread('C:\Users\Chris\Desktop\SORA Science\Test Files\Grating #H1.csv');
x = A(:,1);
xf = x(end);
y = A(:,2);
yf = y(end);
xx = 0:xf
pp = spline(x,y,xx);
plot(x,y,'.',xx,pp);
axis([0,xf,0,100]);
This code successfully plots my data and applies the cubic spline interpolation for a particular file.
How might I be able to integrate the function that is produced?

Respuestas (1)

Walter Roberson
Walter Roberson el 13 de Abr. de 2016

Categorías

Más información sobre Splines en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by