how to interpolate the non uniform resolution in cubic spline?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi all, if I have 6 segments with resolution of 8,8,8,8,8,12, why can not cubic spline interpolate correctly for the last segment? How to solve this problem? Thank you very much
2 件のコメント
John D'Errico
2017 年 12 月 15 日
編集済み: John D'Errico
2017 年 12 月 15 日
Why can't you? Because you did not write the correct code. Sorry, but the computation is trivial with a cubic spline, written correctly to handle unequal spacing between the breaks. (Triviality is sometimes in the eye of the beholder.)
What did you do wrong? That is impossible to know, because we cannot magically see inside your computer, and you did not provide your code.
Most likely, you assumed that the data spacing was uniform, and wrote the equations and code to follow that assumption. So don't do it that way.
If this is for homework, then the issue is you need to write code using the correct equations. If this is for your work or whatever task you are trying to perform, then DON'T WRITE YOUR OWN SPLINE CODE. Use existing tools like spline, or pchip, or interp1, etc.
採用された回答
Image Analyst
2017 年 12 月 15 日
See my attached spline demo. Of course, you can put in any x value you want to get the estimated/spline value at that location.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Splines についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!