0001 function [out] = errorComputation2(x,Prob)
0002 expdata = Prob.user.expdata;
0003 model = Prob.user.model;
0004 out = 0;
0005 if iscell(expdata)
0006 for i = 1:length(expdata)
0007 t = scoreC13Fit(x,expdata{i},model);
0008 out = out + t.error;
0009 end
0010 else
0011 t = scoreC13Fit(x,expdata,model);
0012 out = t.error;
0013 end
0014
0015
0016
0017
0018
0019 if isfield(Prob.user, 'objective')
0020 error = out;
0021 out = Prob.user.objective'*x;
0022 if error > Prob.user.max_error
0023 out = out + Prob.user.multiplier*(Prob.user.max_error-error)^2;
0024 end
0025 end
0026
0027 if isnan(out)
0028 save errorFile x Prob
0029 end
0030 return;