Find entropy of signal for overlapping ranges
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Shubham Rawat
2020년 9월 8일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!