フィルターのクリア

increase processing speed of code entropy histcount

4 ビュー (過去 30 日間)
ALDO
ALDO 2021 年 7 月 27 日
コメント済み: ALDO 2021 年 8 月 3 日
Hi
I have the following code and an trying to calculate entropy of a signal over a moving window. my signal is A=1x1080000. sampling frequency is 125 samples/sec. Please find my code below.
I know my code is correct because it gives me the correct answer when i choose a large window and large shift value. but it take very long to process when the window and shift size are smaller. Does any One have any suggestions on how to optimize it so that it would run faster. Thank you in advance for your help. Please ley me know if anything is unclear.
Best regards,
windowsize=2*125; % 2second window taking into account sampling frequency
shiftsize=floor(1*125);
initial = 1:shiftsize:length(A);
final = windowsize:shiftsize:length(A);
for j=1:length(final)
B=A(initial(j):final(j));
pdf=histcounts(B,'Normalization', 'pdf');
app.entropyA(final) = -sum(pdf.*log2(pdf));
end

回答 (1 件)

Swetha Polemoni
Swetha Polemoni 2021 年 7 月 30 日
Hi
In the following documentation general techniques to improve the performance has been mentioned
Hope you find this helpful
  1 件のコメント
ALDO
ALDO 2021 年 8 月 3 日
thank you for your help!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by