RMS - RMS value of signal

Program code:

function y = rms(x)

%   AUTHOR : Peter L. Soendergaard

% ------ Checking of input parameters ---------

error(nargchk(1,1,nargin));

if ~isnumeric(x) || ~isvector(x)
  error('RMS: Input must be a vector.');
end;

% ------ Computation --------------------------

% It is better to use 'norm' instead of explicitly summing the squares, as
% norm (hopefully) attempts to avoid numerical overflow. Matlab does not
% have 'sumsq'.
y = norm(x)/sqrt(length(x));