Smoothing is good way to remove data if you are post-processing data for analysis.

Smoothing uses both past and future data, and therefore cannot be used for real time noise reduction where future data is not available (for that you will need filtering).

Method 1: Matlab “smooth” command if you have the curve fit toolbox.

Method 2: If you do not have access to the Curve Fit Toolbox, you can use filter command for smoothing.

windowSize = 5;

b = (1/windowSize)*ones(1,windowSize);

a = 1;

ySmoothed = filter(b,a,y);