Code covered by the BSD License  

Highlights from
Interactive Derivative

image thumbnail
from Interactive Derivative by Tom O'Haver
Interactive Derivative 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=boxcar(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=boxcar(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