code for calculating root mean square error of two quantities having different dimensions?
显示 更早的评论
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 个评论
dpb
2014-5-27
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.
采纳的回答
更多回答(1 个)
dpb
2014-5-27
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!