# calibration problem - how to use fminsearch

11 views (last 30 days)
Ingrid on 5 Jun 2015
Commented: Star Strider on 5 Jun 2015 i am trying to do an automatic calibration to find an optimal value for f such that simulation values (=1+a(t)*f) are "equal" to the observed values
however, when I define a sum of squared errors function and minimize this by using fminsearch, the obtained value is clearly not optimal as shown in the attached figure
I have also already tried fminsearch on the Nash Sutcliffe efficiency but this gave the same result, so does using the lsqnonneg. I even tried to just do a fit for the 10 percent highest values (as there is a bias for the peaks as it can be deduced from the scatter plots) but this gave even worse result.
I think the main problem is that there might not be an exact one to one match i.e sometimes peaks in simulated may occur one time step later or earlier than observed but how can I solve this problem? I tried minimizing the error between the moving average of both observed and simulated to account for this possible time lag, but again no better calibration was obtained so I am running out of ideas.
##### 1 CommentShowHide None
Ingrid on 5 Jun 2015
Edited: Ingrid on 5 Jun 2015
and for those wondering about the implementation:
f= fminsearch(@(x) sum((1+a.*x-OBS).^2),1);
f= fminbnd(@(x) sum((1+a.*x-OBS).^2),0,2);
and for the NSE
f= fminsearch(@(x) -NSEcalc(OBS,1+a.*x),1);
function NSE = NSEcalc(obsDATA,simDATA)
NSE = 1 - sum((obsDATA-simDATA).^2)/sum((obsDATA-mean(obsDATA)).^2);
end
for the movingmean I used the function available on the file exchange

Star Strider on 5 Jun 2015
It looks linear, with a zero intercept, so the nonlinear optimisation routines seem to be overkill.
I would estimate ‘f’ as:
f = x(:)\OBS(:);
The (:) guarantee column vectors, necessary for the backslant operator to work in this application.
See if that works.
##### 2 CommentsShowHide 1 older comment
Star Strider on 5 Jun 2015
My pleasure.
I wasn’t certain what your variables or data were, so I guessed as well as I could. How you deal with the time-varying characteristics depends on what ‘time varying’ means in your situation.