DSPRelated.com
Code

Average power of 1D signal

Senthilkumar March 24, 2011 Coded in Matlab

This program is used to calculate the average power of a voice signal

%Function to calculate the Average of a Voice signal
function [y] = pow_1(x)
N =  length(x);  % Length of voice signal 'x'
xold =0.0;       %initialize it to zero
for n = 1:N
    sumx = xold+(x(n)^2);
    xold = sumx;
end
y = sumx/N