Code covered by the BSD License  

Highlights from
Interactive Smoothing

image thumbnail
from Interactive Smoothing by Tom O'Haver
Interactive smoothing for time-series signals

s=bsmooth(a,w) % Convolution-based boxcar smooth % bsmooth(a,w) smooths vector a by a boxcar (rectangular window) of width w % T. C. O'Haver, 1988. v=ones(1,w); S=conv(a,v); startpoint=round((length(v) + 1)/2); endpoint=round(length(a)+startpoint-1); s=
function s=bsmooth(a,w)
%  Convolution-based boxcar smooth
% bsmooth(a,w) smooths vector a by a boxcar (rectangular window) of width w
%  T. C. O'Haver, 1988.
v=ones(1,w);
S=conv(a,v);
startpoint=round((length(v) + 1)/2);
endpoint=round(length(a)+startpoint-1);
s=S(startpoint:endpoint) ./ sum(v);

Contact us at files@mathworks.com