Undefined function or variable error
Show older comments
Hi Guys,
I am a noob in Matlab. I have to calculate different parameters (Bias, BSS, RMSE) alongst a Dune (402 slots) for 250 different profiles. I keep gettint the error Undefined function or variable 'simu'. on the last couple of lines of the Code. I dont know what i am doing wrong...please help?
clear; close all
currentFolder = pwd;
ncFil = fullfile(pwd,'xboutput.nc');
x= nc_varget(ncFil,'globalx');
y= nc_varget(ncFil,'globaly');
zb= nc_varget(ncFil,'zb');
zb_post = load('C:\Users\matth\Desktop\XBeach_MPI\v00_default\POSTmeas\XB_HuMo_POST_nx403ny251_ang326.dep');
zb_ref= load('C:\Users\matth\Desktop\XBeach_MPI\v00_default\Sim\XB_HuMo_FELDENS_OptDep_Dx11-4_Dy4_nx403ny251_ang326_wd-25.dep');
%ny=250
%nx=402
BSS = zeros(250,1) * NaN;
BIAS = zeros(250,1) * NaN;
RMSE = zeros(250,1) * NaN;
for i = 1:250
BSS_i = 0;
Bias_i = 0;
RMSE_i = 0;
for j = 1:402
if nanmean(zb_post(i,j)) == 1
simu = squeeze(zb(end,i,:));
mess = squeeze(zb_post(i,:)).';
ref = squeeze(zb_ref(i,:)).';
end
end
%Variablen belegen
BSS(j,1) = 1 - (sum((simu-mess).^2)/length(simu))/(sum((ref-mess).^2)/length(ref));
Bias(j,1) = sum((simu(:)-mess(:)))/numel(simu);
RMSE(j,1) = sqrt(sum((simu(:)-mess(:)).^2)/numel(simu));
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!