MATLAB: Obtaining smoother polynomials from polyfit for curve fitting (Best Fit Curve) or an alternate function.

best fitcurve fittingdata fittingpolyfitsmooth curve

I am using polyfit to analyze data and perform a curve fit wither several different order polynomials. The end goal is to develop a best fit line for the data that is very smooth (no waves between known data points). Basically, what I want is a smooth best fit line simmilar to using excel. In excell I can ask for up to a 6th order polynomial. It will try to fit my data in such away that the curve is very smooth. When I use polyfit the result tends to be quite wavy in between the known data points. I think the problem lies in the fact that polyfit tries to exactly match the know data points I supply it. Whereas excell will yield polynomials that are not exact matches to the data, but do yield a nice, smooth fit. The end goal is to use these curves to predict the models behavior. This means that having wiggles/waves in the curves is a big problem.
I have not found anything in polyfit's documentation that says it has any options. Could anyone suggest a way I could obtain results more simmilar to excel, be that changes with to how I use polyfit or an alternative function that I am unaware of?
I can't right now, but if necessary I can supply sample code later.

Best Answer

What you are describing sounds like Runge's phenomenon: Check out this blog entry
Related Question