Code covered by the BSD License  

Highlights from
TOFsPRO toolbox

from TOFsPRO toolbox by Dariya Malyarenko
Signal processing for time-of-flight mass spectra over the broad m/z range (1-200 kDa)

mavfilter(s, L)
function mfs = mavfilter(s, L)

%----------------------------------------------------
% Compute L-point moving average for the signal s
%
% INPUT:
% s - observed sampled discrete signal (column vector/s of signal/s);
% L - point window length;
%
% OUTPUT:
% mfs - moving average filtered signal; 
%
% USAGE:
% mfs = mavfilter(s, L);
% Dependency: uses external "filter" function from "signal" toolbox
%
Nc=size(s,2);
mfs=s;
h=1/L*ones(1,L); % create impulse response of the filter;

for i=1:Nc
out=filter(h,1,s(:,i));
out = [out(ceil(L/2)+1:end); s(end-ceil(L/2)+1:end)]; % to correct for the   01/15/08
                                                 % causal phase shift
mfs(1:length(out),i)=out;
end;                                             


return;

Contact us at files@mathworks.com