Hi Felix and Gary,
yes, the two sums could be avoided by simply writing
r=sqrt(sum((data(:)-estimate(:)).^2)/numel(data))
The computation time is about the same but readability might be enhanced by using the colon operator.
Best regards,
Wolfgang
Comment only
10 Oct 2008
RMSE
calculates root mean square error from data vector or matrix and the corresponding estimates.
Felix Hebeler
@Gary: no, you need two sums if you process matrices, the first sums across all columns, the second then sums across the resulting vector. If you process vectors, the second sum calculates the sum of a scalar. Faster than checking for dimensions first.
Comment only
09 Oct 2008
RMSE
calculates root mean square error from data vector or matrix and the corresponding estimates.
Gary Merkoske
you have one too many SUM() in the eqn, although it appears to be harmless. Am I correct? RMS Error is then;
r=sqrt(sum((data-estimate).^2)/numel(data))
Comment only