% APRENDIZAJE AUTOMÁTICO (G. Pajares y J. M. de la Cruz, Eds.)
% Editorial: RA-MA
% Capítulo 5: Máquinas de Vectores Soporte
% Autores: Jesús Antonio Vega Sánchez y Sebastián Dormido Canto

function cfd=pintarwavelet(senal,nivel)

lv=length(senal);

wavelet='haar';
[c, l] = wavedec(senal,nivel,wavelet);

% Expand discrete wavelet coefficients for plot.
% Levels 1 to 5 correspond to scales 2, 4, 8, 16 and 32.
        cfd = zeros(nivel,lv);
        for k = 1:nivel
                d = detcoef(c,l,k);
                d = d(:)';
                d = d(ones(1,2^k),:);
                cfd(k,:) = wkeep(d(:)',lv);
        end
        cfd =  cfd(:);
        I = find(abs(cfd)<sqrt(eps));
        cfd(I)=zeros(size(I));
        cfd = reshape(cfd,nivel,lv);
        
        
        
        
map     = pink(128);   
colormap(map);

img = image(wcodemat(cfd,64,'row'));


