Fit two csaps in one set of data with condition

3 views (last 30 days)
Hello,
I have data that when plotted looks like this:
I would like to fit two separate smoothing spline (csaps) to the points before and after the area in the middle that is sparse/zero. Alternatively, the spline could drop to zero in that area but I don't think that is possible. I would like to automate this so that I don't have to specify the range to fit the spline. Should I just split the data, fit the splines, then recombine? What is the most efficient way to do this? I've attached the data as a csv. Thanks for any help!
  1 Comment
walkswithlooselaces
walkswithlooselaces on 29 Oct 2021
I was able to get this to work just using the following and manual selecting a point in the middle. I decided it wasn't worth it to automate.
mid=300 %select low and high data, mid is a point in the occlusion area
y_low=y(x<mid)
x_low=x(x<mid)
y_high=y(x>mid)
x_high=x(x>mid)
plot(x_low,y_low,'.')
plot(x_high,y_high,'.')

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!