function analisa_esparsidade(M)
n = size(M,1);
m = size(M,2);
h = zeros(2,0);
emin = -16;
nh = 0;  %numero de colunas da matriz h 
for i = 1:n
    for j = 1:m
        if M(i,j) == 0
            l = -300;
        else
            l = log10(abs(M(i,j)));
        end
        l = max(l,emin);
        kl = floor(l);
        fl = l - kl;
        kl = kl - emin + 1;
        while (nh <= kl)
            nh = nh + 1;
            h(1,nh) = nh + emin - 1;
            h(2,nh) = 0;
        end
        
        h(2,kl) = h(2,kl) + (1-fl);
        h(2,kl + 1) = h(2,kl+1) +fl;
    end
end

hh = zeros(2,2*nh + 2);
hh(1,1) = emin;
hh(2,1) = 0;
j = 2;
for i = 1:nh
    hh(1,j) = hh(1,j-1);
    hh(2,j) = h(2,i) ;
    hh(1,j+1) = hh(1,j) + 1;
    hh(2,j+1) = hh(2,j);
    j = j + 2;
end
hh(1,j) = hh(1,j-1);
hh(2,j) = 0;
    
plot(hh(1,:),hh(2,:))
set(gca,'Fontsize', 20)
