function segmentation_Shennon close all clear all % Load the data file
[F, Fs] = audioread ('1.wav'); pcg = F (:, 2); t = 0: 1 / Fs: (length (F) -1) / Fs; %%We normalize and filter the signal with a Chebyshev filter of 1 8th order NP with a frequency of medium 882 Hz
pcg_filter = chebushev1 (pcg, Fs); pcg_norm = pcg_filter./abs(max(pcg_filter)); % calculate the energy of Shannon
shennon_energy = - ((pcg_norm. ^ 2). * log (pcg_norm. ^ 2)); figure (1) plot (t, shennon_energy) % calculate the average Shannon energy in a segment lasting 0.02 s
% with an overlap of 0.01 s
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 % we normalize Shannon's averaged energy
M_Es = (mean (Es)); % mean energy of the segment
S_Es = (std (Es (k-1))); % standard deviation of the energy of the segment
P (k) = (Es (k-1) -M_Es) / S_Es; % Shannon's normalized averaged energy,
plot (t, P)
MATLAB: Hi,i am trying to run the following program,but it shows index out of bounds .length of the signal loaded is=10240 and when i am taking square for x ,it shows index out of bounds error and also one more error is undefined function chebyshev
average shannon erengy
Best Answer