Find entropy of signal for overlapping ranges
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ALDO
el 5 de Sept. de 2020
Comentada: ALDO
el 8 de Sept. de 2020
Hi
I would like to calculate entropy for the following array
P= 2987 2887 2999 2880 .... (cell array with 3867 elements, data is collected at 1 second interval)
i would like to calculate entropy for this array for the following elemets 1-10, 5-15, 10-20,15-25,... ( so basically every 10 seconds overlaping 5 seconds till end of array)
I wanted to used the following code but I dont know how to do the ranges. Thanks for your help in advance!
entropy= -sum(p*log2(P));
h1=histogram(your_signal, 'Normalization', 'Probability');
h1.Values;
0 comentarios
Respuesta aceptada
Shubham Rawat
el 8 de Sept. de 2020
Hi ALDO,
You can form an two arrays of ranges which contain initial and final value of interval. Here is the reproduced code which you can refer:
initial = 0:5:3867; %initial values of intervals
initial(1) = 1;
final = 10:5:3867; %final values of intervals
Now you may calculate entropy of ranges like this:
for i = 1:length(final)
p = P(initial(i):final(i)); %values inside the interval i
results(i) = -sum(p.*log(p)); %calculate entropy of that interval
end
where results array contains entropy of each interval.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!