%%function xthresh=mthresh(data);
%%By Joakim Lindblad 2000-02-24
%% Calculates "magic" background threshold

function xthresh=mthresh(data);

data=data(:); %if not done already
sigma=max(h_rot(data),2) %minsigma is 2 to avoid quantization artefacts
xthresh=chistplotone(data,0.2,sigma);  
