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)

noiseEstmtr2 (spect)
function ns = noiseEstmtr2 (spect)

%----------------------------------------------------
% Estimate noise level (STD) for TOF record (assuming constant peak width)
%
% INPUT:
% spect - spectrum signal (resampled or range of constant peak width);
%
% OUTPUT:
% ns - noise estimate assuming Gaussian (random) noise;
%
% USAGE:
% ns = noiseEstmtr2 (spect);
% Dependency: none
%

 
%% Part 1  Noise Level Estimation

len=length(spect); 

A=spect(1:(len-1)); 
B=spect(2:end); 
difference=A-B; 
spect=sort(difference); 
tstart=min(find(spect>0))-round(0.05*len);
tend=tstart+round(0.1*len);
spect=spect(tstart:tend);
tt=1:length(spect); tt=tt';
coef=polyfit(tt,spect,1);
ns=len*coef(1)/3.55;


return;

Contact us at files@mathworks.com