%============================================================
% A function y=Thr_univ(X) estimates the noise standard deviation
% using the MAD estimator of Donoho for a matrix X in the following way
% y=median({X[i][j]-median({X[i][j]})}/0.6745

% Aleksandra Pizurica TELIN, RUG
%=============================================================

function y=Thr_univ(X)

med=median(median(X));
y=median(median(abs(X-med)))/0.6745;