function y = RMS(x)

% function RMS(X)
% Returns root mean square of vector or matrix X

%  Author: Andreas Floros
%  Digital Audio Processing Applications Group
%  Dept. of Audiovisual Arts, Ionian University
%  v.1.0 - Last Modified: 21/03/2009.

ix=find(~isnan(x));

if ( length(ix) > 1)
  y = sqrt( mean(x(ix).*x(ix)) );
else
  y = nan;
end
