Fitting a smoothing spline method

1 回表示 (過去 30 日間)
vedesh Mohit
vedesh Mohit 2018 年 4 月 2 日
回答済み: William Smith 2018 年 4 月 3 日
hey, I have a dataset x=[NaN 1 2 3 NaN NaN 4 7 9 NaN 8 28 8 ]; and I would to know how to fit a smoothing spline method to this data?

回答 (1 件)

William Smith
William Smith 2018 年 4 月 3 日
spline takes data in the format ( known X's, known Y's, desired X's)
So, for example:
desiredx=1:0.1:13;
xfitted = spline(1:numel(x), x, desiredx);
plot(desired, xfitted);
That's just a simple cubic spline. See also 'pchip', which has the same API. Smoothing splines more formally have a 'pressure' to penalise excessive curvature. If you need them, they're in the Curve Fitting Toolbox.

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by