Entropy of an audio signal

10 次查看(过去 30 天)
Ana
Ana 2011-9-13
i am trying to find the entropy of an audio signal, so i need first the probability of appearance of each values of the signal, the problem is, i have this values due to the histogram i did but how can i get those values and save them into a vector in order to fins the entropy? i already have the entropy function!
function entro = entropia(x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
x=[.5 .25 .125 .0625 .0625]; % these values must be the appearence probability of my signal values
tam=length(x); % tamaño del vector x
suma= 0;
for i=1:tam % hacer un for desde 1 hasta el tamaño del vector x
h= x(i)*log2(1/x(i)); % funcion de entropia
suma = suma+ h; % la suma acumula los valores obtenidos por cada valor del vector x
end
entro = suma;
coder.extrinsic('disp')
disp (entro);
end
please help!

回答(1 个)

maria
maria 2012-9-25
Maybe it's too later, but:
1. For extract probability use 'hist' function: p = hist(signal) or p = hist(signal, lengths)
2. Don't need that long code for entropy! I think it's wrong, because is 'log2(x(i))' and not 'log2(1/x(i))'. But really better you replace ALL and use only: -sum(p.*log2(p))
Good Luck!

类别

Help CenterFile Exchange 中查找有关 Measurements and Feature Extraction 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by