?? rms2.m
字號:
% rms2.m
% Scope: This MATLAB macro computes modified root mean square (modified RMS)
% of a sample.
% Usage: y = rms2(x)
% Description of parameters:
% x - input, sample (row or column) vector with m elements
% y - output, RMS2 value, i.e. square root of (sum of squares
% normalized by number of elements)
% Remark: The modified RMS is identical to the textbook RMS when the sum of all
% sample elements is zero.
% Last update: 09/27/00
% Copyright (C) 1996-00 by LL Consulting. All Rights Reserved.
function y = rms2(x)
[m,n] = size(x);
if n ~= 1
x = x';
m = n;
end
if m == 1
y = 0.;
else
y = 0.;
for i = 1:m
y = x(i) * x(i) + y;
end
y = sqrt(y/m);
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -