MATLAB: Best Smoothing Function in Matlab

filtersmoothing

What are your thoughts on the best Matlab smoothing function? I have will have two set of data. The first should be similar to a sine/cosine wave. The other one is more difficult to explain. Think of a leaf falling from a tree and how it oscillates back and forth as it falls down. That is what my data should look like.

Best Answer

There are lots of them. Forget about the "best" and go for one that works for your signals. Maybe you can try sgolay() in the Signal Processing Toolbox, which fits a polynomial in a piecewise/windowed fashion as it moves along your signal. You could modify it pretty easily if you didn't want to apply it at the "sharp" parts of your signal where your "leaf" reverses direction. Just apply sgolay, then look for peaks, and replace the peak locations with the original signal instead of the smoothed signal.
Related Question