diff Code/Descriptors/Matlab/Common/ShortTimeEnergy.m @ 0:ea0c737c6323

first commit
author Dawn Black <dawn.black@eecs.qmul.ac.uk>
date Thu, 26 Jul 2012 14:46:25 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Code/Descriptors/Matlab/Common/ShortTimeEnergy.m	Thu Jul 26 14:46:25 2012 +0100
@@ -0,0 +1,12 @@
+function E = ShortTimeEnergy(signal, windowLength, step);
+signal = signal / max(max(signal));
+curPos = 1;
+L = length(signal);
+numOfFrames = floor((L-windowLength)/step) + 1;
+%H = hamming(windowLength);
+E = zeros(numOfFrames,1);
+for (i=1:numOfFrames)
+    window = (signal(curPos:curPos+windowLength-1));
+    E(i) = (1/(windowLength)) * sum(abs(window.^2));
+    curPos = curPos + step;
+end