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.
For a window span of 5
yy(3) = (y(1) + y(2) + y(3) + y(4) + y(5))/5
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);