


Function to calculate root mean square error from a data vector or matrix and the corresponding estimates. Usage: r=rmse(data,estimate) Note: data and estimates have to be of same size Example: r=rmse(randn(100,100),randn(100,100));


0001 function r=rmse(data,estimate) 0002 % Function to calculate root mean square error from a data vector or matrix 0003 % and the corresponding estimates. 0004 % Usage: r=rmse(data,estimate) 0005 % Note: data and estimates have to be of same size 0006 % Example: r=rmse(randn(100,100),randn(100,100)); 0007 0008 % delete records with NaNs in both datasets first 0009 I = ~isnan(data) & ~isnan(estimate); 0010 data = data(I); estimate = estimate(I); 0011 0012 r = sqrt( sum( (data(:)-estimate(:)).^2) / numel(data) ); 0013