calibration problem - how to use fminsearch

6 views (last 30 days)
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 Comment
Ingrid
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

Sign in to comment.

Accepted Answer

Star Strider
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 Comments
Ingrid
Ingrid on 5 Jun 2015
thanks for the tip. I thought it was a nonlinear problem because the a is not a constant but time varying
but to use the backslash operator it is not x that I should use if I read the documentation of lsqnonneg correctly but as follows:
f= a(:)\(OBS(:)-1);
this gives me exactly the same value as before, but speeds up things so good to know since I have to repeat this many times.
I have detected a problem with the calculation of a in my code so that was causing the problem and not the optimization itself so I am happy to have finally figured it out after wasting another day.
Star Strider
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!