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 CenterFile Exchange에서 Splines에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by