Determine spline functions using left division

1 回表示 (過去 30 日間)
Corey Nehoda
Corey Nehoda 2016 年 11 月 21 日
回答済み: Jose Lara 2016 年 11 月 29 日
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.

回答 (1 件)

Jose Lara
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

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by