Determine spline functions using left division
1 次查看(过去 30 天)
显示 更早的评论
I am trying to write a code that will solve for the spline functions of a data set using left division. I have gotten through the left division part but I'm not sure how to turn this into spline functions. Here is my code so far.
x=[1.6, 2, 2.5, 3.2, 4, 4.5];
y=[2, 8, 14, 15, 8, 2];
A=x\y
Any help is appreciated, Thanks.
0 个评论
回答(1 个)
Jose Lara
2016-11-29
MATLAB's built-in function ''spline'' can solve spline functions. The function outputs the breaks, polynomial coefficients and the order of the function. You can use the function as shown below:
x=[1.6, 2, 2.5, 3.2, 4, 4.5];
y=[2, 8, 14, 15, 8, 2];
pp = spline(x,y);
The variable 'pp' will be a struct with fields named 'breaks', 'coefs', 'pieces', 'order', and 'dim'. These can be used to build the spline functions. Also, if you would like to find more points that can be included in the spline function, you can specify the independent variable as shown below:
x=[1.6, 2, 2.5, 3.2, 4, 4.5];
y=[2, 8, 14, 15, 8, 2];
xx = 0:0.25:10;
pp = spline(x,y);
Variable 'pp' will now be the output of the spline function. Check out the following link for more information regarding the ''spline'' function: http://www.mathworks.com/help/matlab/ref/spline.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Splines 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!