Cubic spline interpolation with slope at left end equal to zero?

9 ビュー (過去 30 日間)
Qingjie
Qingjie 2014 年 4 月 25 日
コメント済み: Qingjie 2014 年 4 月 30 日
Hi, all,
I am doing a cubic spline interpolation with some data points. I want the slope at the left end to be zero and don't do anything to the slope at the right end(In the online example, both slope at both ends are forced to be zero). Does anyone know how to do this? Thank you.
Here is my data points:
if true
x = [0,0.152789493879,0.305539702586,0.458371723707,...
0.59356259,0.728929965449,0.864429595769,1];
y = [0,0.013083199999528,0.155041100006201,0.209241100004874,...
0.178395800001454,0.093888600007631,-0.033515100003569,-0.196524899991346];
end
  2 件のコメント
John D'Errico
John D'Errico 2014 年 4 月 25 日
Why do you think you need the (if true) conditional wrapped around it?
Qingjie
Qingjie 2014 年 4 月 25 日
Physically, the left point is a energy minimum point, which means the slope should be zero. But due to the limited number of data points, I guess spline interpolation cannot produce a zero slope at the left point.

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2014 年 4 月 25 日
My SLM tool box will let you create an interpolating spline with the properties you desire.
pp = slmengine(x,y,'knots',x,'leftslope',0,'result','pp');
There are many other things it can do, but this is a simple one. You can get the result in a pp form as I show, or in my own SLM format.
  3 件のコメント
John D'Errico
John D'Errico 2014 年 4 月 26 日
編集済み: John D'Errico 2014 年 4 月 26 日
No. Never put downloaded files in the MATLAB toolbox directories. This will cause problems. Instead, put the downloaded (unzipped) directory some place on your drive, then add that directory to your MATLAB search path. (Use pathtool for this, saving the new search path afterwards.)
Qingjie
Qingjie 2014 年 4 月 30 日
Thank you very much John. It works really well. Also thank you for a very wonderful comment on my previous question on nonlinear fitting.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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