Average normalised Shannon energy for phonocardigraphy signals

11 次查看(过去 30 天)
I have a code that has to calculate average normalised Shannon energy for phonocardigraphy signals but have a problem with calculating standard deviation. mayve something wrong with my code above this expression. Can somedody help me. please.
function segmentation_Shennon
close all
clear all
% Загружаем файл с данными
[F,Fs] = audioread('1.wav');
pcg = F(:,2);
t=0:1/Fs:(length(F)-1)/Fs;
%%Нормируем и фильтруем сигнал фильтром Чебышева 1 8го порядка НЧ с частотой среда 882 Гц
pcg_filter = chebushev1(pcg,Fs);
pcg_norm = pcg_filter./abs(max(pcg_filter));
%рассчитываем энергию Шеннона
shennon_energy= -((pcg_norm.^2).*log(pcg_norm.^2));
figure(1)
plot(t,shennon_energy)
%рассчитываем усредненную энергию Шеннона в сегменте длительностью 0,02с
%с перекрытием 0.01 с
win=0.002*Fs;
i=1;
k=1;
Es=[];
Es_t=[];
P=[];
while i<length(pcg_norm)
for i=i:i+win
square = pcg_norm(i).^2;
Es(k) = -1/win * sum( square .* log(square));
end
ES_t(k)=t(i);
i=i+round(win/2);
k=k+1;
end
% нормируем усреднeнyую энергию Шеннона
M_Es = (mean(Es)); %среднее значение энергии сегмента
S_Es = (std(Es(k-1))); %стандартное отклонение энергии сегмента
P(k) = (Es(k-1)-M_Es)/S_Es; % Нормированная усредненная энергия Шеннона,
plot(t,P)
  2 个评论
Brian Sang;Sang
Brian Sang;Sang 2022-4-18
Hi, I understand what question you are trying to solve as it refers to Heart Sound Segmentation Algorithm Based on Heart Sound Envellogram and this is how I solved it.
N=0.02*Fs;
win = N;
k=1;
i = 1;
Es=[];
Es_t=[];
P=[];
m = length(filter)/N;
t=0:1/Fs:(length(norm)-1)/Fs;
for k = 1:m
for i = win*(k-1)+1:win*(k)
F1(i) = (norm(i).^2 * log(norm(i).^2));
end
Es(k) = -1/N* sum(F1);
F1 = [];
end
for k = 1:m
M_Es = (mean(Es));
S_Es = (std(Es));
P(k) = (Es(k)-M_Es)/S_Es;
end
tk = 0:60/(m-1):60;
[yupper,ylower] = envelope(P);
plot(tk,yupper)
Arthur Guilherme Santos Fernandes
Does the "Es" have the same length as the normalized signal ?
I am trying to reproduce this thecnique based on a paper, and they have this picture:
As if the Average Shannon Energy has the same length of the original signal.
This got me confused, i want to reproduce this picture but i can't because in my case i'm getting "Es" as a shorter array, since we do the splits of 0.02s.

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2015-11-22
I am guessing here because I cannot run your code. You are taking the standard deviation of the second-to-last value of ‘Es’ in your loop. See if changing the standard deviation calculation to:
S_Es = (std(Es)); %стандартное отклонение энергии сегмента
gives you the correct result.
  2 个评论
Stefaniya Pirogova
Stefaniya Pirogova 2015-11-22
yes, you're right, thank you. but still have problem with P(k) here is an archive where all the files that you need for running, can you, please, have a look at them?
Star Strider
Star Strider 2015-11-22
My pleasure.
I do not download and open .zip files. If your .zip file contains your data, please save your data as a .mat file instead. (See the documentation for the save function for all the details.)
I understand phonocardiography (I am an Internal Medicine physician), but I have no idea what analysis you are doing. Do you have a PDF reference for it (in English), since I do not recognise what you are doing from your code. I cannot promise any solution even then, but at least I might have some idea.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Signal Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by