Determine spline functions using left division

3 visualizaciones (últimos 30 días)
Corey Nehoda
Corey Nehoda el 21 de Nov. de 2016
Respondida: Jose Lara el 29 de Nov. de 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.

Respuestas (1)

Jose Lara
Jose Lara el 29 de Nov. de 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

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by