How can I integrate a set of data that has been fit with a cubic spline interpolation?
20 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Splines 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!