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)

bsMinMav (sigt, pw, nf)
function bst = bsMinMav (sigt, pw, nf)

%----------------------------------------------------
% Estimate baseline trend (with peak pedestals) for TOF data assuming 
% constant peak width using moving average of local minima
%
% INPUT:
% sigt - spectrum signal;
% pw - peak half-width (used for window width for MAV~ 10*HWFM is a good start)
% (assumes that peaks are the same width: valid for resampled data)
% nf - number/fraction of width in window
%
% OUTPUT:
% bst - baseline trend estimate;
%
% USAGE:
% bst = bsMinMav (sigt, pw, nf);
% Dependency: none
%

ww = floor(nf*pw); %window width for MAV~ 10*HWFM is a good start

if ww < 2 ww = 2; end;

for i=(ww+1):(length(sigt)-ww)
bs0(i-ww)=min(sigt(i-ww:i+ww));
end;

bs0=[zeros(1,ww)+min(sigt(1:ww)), bs0, zeros(1,ww)+min(sigt(end-ww:end))];

%plot([bs0', sigt])

bst = mavfilter(bs0', ww);

return;

Contact us at files@mathworks.com