Determine spline functions using left division

3 vues (au cours des 30 derniers jours)
Corey Nehoda
Corey Nehoda le 21 Nov 2016
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.

Réponses (1)

Jose Lara
Jose Lara le 29 Nov 2016
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

Catégories

En savoir plus sur Splines dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by