Code covered by the BSD License  

Highlights from
rms.m

Be the first to rate this file! 75 Downloads (last 30 days) File Size: 1.61 KB File ID: #24039

rms.m

by Phillip M. Feldman

 

08 May 2009

compute root-mean-square (RMS) of values supplied as a vector, matrix, or list of discrete values

| Watch this File

File Information
Description

rms computes the root-mean-square (RMS) of values supplied as a vector, matrix, or list of discrete values (scalars). If the input is a matrix, rms returns a row vector containing the RMS of each column.

David Feldman proposed the following simpler function definition:

RMS = sqrt(mean([varargin{:}].^2))

With this definition, the function accepts ([1,2],[3,4]) as input, producing 2.7386 (this is the same result that one would get with input of (1,2,3,4). I'm not sure how the function should behave for input of ([1,2],[3,4]). Probably it should produce the vector [rms(1,3) rms(2,4)]. For the moment, however, my code simply produces an error message when the input is a list that contains one or more non-scalars.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
rms Phillip M. Feldman 08 May 2009 10:13:01
rootmeansquare Phillip M. Feldman 08 May 2009 10:13:01
average Phillip M. Feldman 08 May 2009 10:13:01
rms Hardik 17 Feb 2010 17:15:03
rms min-a 02 Jun 2011 09:07:18
rms eythimis idol 16 Sep 2011 05:59:03
rms Yue 03 Jan 2012 11:51:27

Contact us at files@mathworks.com