Need to spline, wondering if possible to do this in a "best fit" way.

1 Ansicht (letzte 30 Tage)
andi shahaj
andi shahaj am 4 Jul. 2017
Beantwortet: Greg Dionne am 7 Jul. 2017
Let me elaborate a little on what I'm trying to figure out. Let's say I have a set of 100 points, and I wanted a smooth curve for them, but their position is quite erratic (they follow the same general direction however). I need to fit this to a curve, but fitting all the points to one polynomial would be meaningless. Instead what I would like to do is imitate what the spline function does, however the spline function interpolates between points, what I would like to do is find the 2nd or 3rd degree polynomial of best fit for say intervals of 10 points and connect them together as a piecewise function, but like spline it needs to be smooth, as I need to be able to take the derivative at any of the points. Is there a way to do this?
  2 Kommentare
KSSV
KSSV am 5 Jul. 2017
Pick every ten points and use polyfit....won't it do what you want?
andi shahaj
andi shahaj am 5 Jul. 2017
but i need the next polyfit to fit "smoothly" with the previous, meaning that the limit of the slope at the point where they are "tied" together needs to be the same for the two polyfits.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Greg Dionne
Greg Dionne am 7 Jul. 2017
Try using sgolayfilt in the Signal Processing Toolbox.

Kategorien

Mehr zu Spline Postprocessing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by