?? rms.m
字號(hào):
% rms.m
% Scope: This MATLAB macro computes root mean square (RMS) of a sample.
% Usage: y = rms(x)
% Description of parameters:
% x - input, sample (row or column) vector with m elements
% y - output, RMS value (normalized by m-1); if the sample
% vector has only one element then the result is 0.
% Last update: 09/27/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
function y = rms(x)
[m,n] = size(x);
if n ~= 1
x = x';
m = n;
end
if m == 1
y = 0.;
else
avg = sum(x)/m;
y = - avg * avg;
for i = 1:m
y = x(i) * x(i) + y;
end
y = sqrt(y/(m-1));
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -