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)

gpdf_hw(nf,n_mu)
function sigma = gpdf_hw(nf,n_mu)
% 
% This function estimated the left half-width of a peak assuming Gaussian
% lineshape
%
% OUTPUT:
%
% sigma - estimated half-width
%
% INPUT:
% nf- signal around the peak;
% n_mu - peak location;
% 
% USAGE:
% sigma = gpdf_hw(nf,n_mu);
% Dependency: none
%
if (nargin < 2) | (nargin < 1)
  error('Requires both the data array and the peak position as an input');
  sigma = NaN;
end

%[errorcode x mu sigma] = distchck(3,x,mu,sigma);

%if errorcode > 0
%    error('Requires non-scalar arguments to match in size.');
%end

fmax=nf(n_mu);
fhalf=0.5*fmax;
lhalf=1;

while ((n_mu-lhalf) >= 1) & (nf(n_mu-lhalf) > fhalf)
  lhalf=lhalf+1;
end;
%lhalf
if (n_mu-lhalf>=1) & (nf(n_mu-lhalf)<=fhalf)
  % sigma=ceil(lhalf/sqrt(2*log(2))); %% for normal PDF
  % tau=ceil((sqrt(2)-1)/lhalf); %% for Lorentzian
  sigma=lhalf; %% not normalized
else
  %disp('Could not find half maximum: input array is too narrow');
  %disp('at the peak'); n_mu
  sigma=-1;
end  

return;

Contact us at files@mathworks.com