function [relative]  =  relative_power_mat3d (espectro)
        
    [n_epochs, n_muestras, n_freq, n_channels] = size(espectro);
    
    relative = zeros (n_epochs, n_muestras,n_channels,2);
    
    for j =1:n_epochs
        for i=1:n_channels
            relative(j,:,i,1)= trapz(abs(squeeze(espectro(j,:,8:12,i))),2) ./ trapz(abs(squeeze(espectro(j,:,:,i))),2);
            relative(j,:,i,2)= trapz(abs(squeeze(espectro(j,:,14:30,i))),2) ./ trapz(abs(squeeze(espectro(j,:,:,i))),2);
        end
    end