function [bk] = dist_to_bartlet(distmat,b)
% Construct Bartlet weights from distance matrix using bandwidth b
% Step .. normalize distmat so that longest distance is 1
mm = max(max(distmat));
dm = distmat/mm;
dmb = dm/b;
bk = 1-dmb;
ii = bk < 0;
bk(ii) = 0;
end

