Sibbs Gambling
Sibbs Gambling

Reputation: 20345

Smooth spline curve with cscvn in MATLAB?

I am facing the following dilemma.

"Natural" or periodic interpolating cubic spline curve (cscvn) allows me to fit an interpolating spline curve that passes all the control points. However, in my problem the data points are noisy, so an interpolating spline curve has many zig-zags.

enter image description here

So I thought maybe I need an approximating (instead of interpolating) spline curve that doesn't necessarily pass through all the points. Then I came across cubic smoothing spline (csaps).

enter image description here

Now the curve is indeed smoother, but it has problems when I have multiple y values around an x value. So the fitting result is not really "correct".

How do I have a smooth and "correct" fitting?

Upvotes: 0

Views: 1116

Answers (1)

user7092207
user7092207

Reputation:

You should take the maximum von the y values and that's it.

Or if you believe that the noisy end is correct you should enlarge the bin size (variable bin size). This will lead to a good spline but the curve will drop.

It depends on what you believe is correct. In anyway enlarging the bin size also in the "smooth" part of the curve (<200) should improve the smoothness of the spline.

Upvotes: 2

Related Questions