Save cubic spline coefficients to use as response in regression
古いコメントを表示
Hi community,
I have two vectors and I would like to fit a cubic spline to:
y=[18.93000031 19.42000008 19.51000023 19.67000008 19.68000031 19.71999931];
x=[58.61111111 67.32055556 70.56194444 74.22694444 78.39388889 85.11555556];
I would also like to save the parameters of the fit at every point to use in regression analysis as my response (I want to change other variables at the points where I take a measurement in an experimental design.) How can I do this. I've not a very advanced matlab user but I hope this is an easier question for a pro in the community to answer.
3 件のコメント
John D'Errico
2015 年 2 月 24 日
(Despite my being reasonably knowledgable about splines and regression analysis) I have absolutely no idea what you mean by this statement:
"save the parameters of the fit at every point to use in regression analysis as my response"
Please clarify.
Ernest Modise - Kgamane
2021 年 3 月 2 日
Hi D'Errico,
Kindly assist,
Using your code example:
x=[58.61111111 67.32055556 70.56194444 74.22694444 78.39388889 85.11555556];
y=[18.93000031 19.42000008 19.51000023 19.67000008 19.68000031 19.71999931];
S = spline(x,y)
S =
form: 'pp'
breaks: [58.611 67.321 70.562 74.227 78.394 85.116]
coefs: [5x4 double]
pieces: 5
order: 4
dim: 1
I get the following error
>> splineeg
Error: File: splineeg.m Line: 4 Column: 5
Invalid expression. Check for missing or extra characters.
What could be the mistake,
採用された回答
その他の回答 (1 件)
Shoaibur Rahman
2015 年 2 月 24 日
pp = spline(x,y);
NewValue = [1 2]; % may be scaler or vector
out = ppval(pp,NewValue)
3 件のコメント
Brandon
2015 年 2 月 24 日
Shoaibur Rahman
2015 年 2 月 24 日
Perhaps, you have already got it! coefficients are in pp. NewValue is any value used for interpolation using the coefficients in pp. Thanks.
oshawcole
2017 年 9 月 29 日
How would you find a polynomial equation from the given x and y points?
カテゴリ
ヘルプ センター および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!