code for calculating root mean square error of two quantities having different dimensions?
Show older comments
I am doing floating to fixed point conversion. output of Fixed point conversion has different dimensions than the same of floating point engine. How to calculate root mean square error in such a case?
er = M - x; er = sqrt((er(:)'*er(:))/length(er(:))); Using the above formulas, matlab's giving error that matrix dimensions must agree
1 Comment
dpb
on 27 May 2014
Fix the output to have the same number or truncate the longer of the two to the shorter. It makes no sense to talk of a error if there's nothing to compare to.
Accepted Answer
More Answers (1)
dpb
on 27 May 2014
Agree w/ cycler that it's confusing why this should be so, but the answer to the question ...trying to truncate the larger of the two to the smaller one & then trying to find the error is pretty simple.
N=min(length(M), length(x));
er=M(1:N)-x(1:N);
Now, whether that really makes any sense or not is beyond the amount of information we have to judge but it should solve your immediate problem programmatically, anyway.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!