Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Hi,i am trying to run the following program,but it shows index out of bounds .length of x=10240 and when i am taking square for x ,it shows index out of bounds error

8 visualizaciones (últimos 30 días)
function segmentation_Shennon close all clear all % Load the data file [pcg, Fs] = audioread ('D:\phase 2 sets\audio signals\trim\normalcut.wav'); pcg = F (:, 2); t = 0: 1 / Fs: (length (pcg) -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 =pcg; 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)); % 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)

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by