MATLAB Answers

0

RMS error of matrices

Hi,

I have 2 large matrixes (2048x2048), and have taken one away from the other to get a 'difference' matrix. I want to quantify this matrix by using an RMS error, however if I use a standard RMS error formula I get another 2048x2048 matrix.

Is there a way to get a single representative RMS value out?

Thanks,

Richard

  0 Comments

Sign in to comment.

2 Answers

Answer by Walter Roberson
on 6 Apr 2011
 Accepted Answer

Isn't it usually

sqrt(mean(A(:).^2 - B(:).^2))

  0 Comments

Sign in to comment.


Answer by darksideofthemoon101 on 6 Apr 2011

I've been using

rms = sqrt((A - B)^2))

How dissimilar are these equations?

  1 Comment

When A and B are arrays then A-B is an array, and (A-B)^2 is
(A-B)*(A-B) which is a matrix multiplication which will produce an output the same size as A (in this case.) sqrt() of that would then be the same size.

Nothing in your code calculates the _mean_ portion of "RMS". Root MEAN square.

Possibly I should have suggested

sqrt(mean((A(:)-B(:)).^2))

but I am too tired to look up the definition at the moment.

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today