필터 지우기
필터 지우기

Entropy of an audio signal

조회 수: 8 (최근 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에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by