1% The RMS error between two variables. 2% 3% r = divand_rms(x,y,norm) 4% 5% Returns rms between x and y (taking norm into account if present) 6 7% Alexander Barth 8function r = divand_rms(x,y,norm) 9 10d = x-y; 11 12if nargin == 3 13 d = d .* sqrt(norm); 14end 15 16m = ~isnan(d); 17r = mean(d(m).^2); 18 19if nargin == 3 20 r = r/mean(norm(m)); 21end 22 23r = sqrt(r); 24% Copyright (C) 2014 Alexander Barth <a.barth@ulg.ac.be> 25% 26% This program is free software; you can redistribute it and/or modify it under 27% the terms of the GNU General Public License as published by the Free Software 28% Foundation; either version 2 of the License, or (at your option) any later 29% version. 30% 31% This program is distributed in the hope that it will be useful, but WITHOUT 32% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 34% details. 35% 36% You should have received a copy of the GNU General Public License along with 37% this program; if not, see <http://www.gnu.org/licenses/>. 38