MATLAB Answers

Model calibration in Matlab: find minimum RMSE

36 views (last 30 days)
yoni verhaegen
yoni verhaegen on 4 Jun 2018
Commented: Jeff Miller on 5 Jun 2018
Hi all,
I have a model that runs a mass balance profile for a glacier (i.e. the net result between melt and snow accumulation). However, I have a set of 7 variables to calibrate the model. I was wondering if there is some kind of small program I can write to run the model several times with all different values for the parameters within a certain range, in order to find the minimum RMSE. For example, parameter 1 from 0.4 to 0.6, parameter 2 from 0.34 to 0.42, etc. I was thinking about a random walk method but it is hard to write these kind of things. It would be very much appreciated. Can anybody help me getting started?
Thanks!

Answers (1)

Jeff Miller
Jeff Miller on 4 Jun 2018
It seems like you have to start by writing the function to compute RMSE for a given set of parameter values, e.g.,
function thisRMSE = myRMSE(x)
% x is a vector of 7 parameter values.
% thisRMSE is the RMSE for those values.
% ...
end
After you have that, you can use fminsearch, which will probably do a better job of finding the minimum RMSE than a random walk.
StartingGuess = [0.5, 0.38, ...]; % Your initial best-guesses for the 7 parameter values.
[BestGuess, BestRMSE] = fminsearch(myRMSE,StartingGuess);
If the solution space is nasty, there is a good chance that fminsearch will get caught in a local minimum (as too would your random walk process). The only thing you can do about that is to run fminsearch repeatedly from lots of different starting guess vectors, keeping whichever final 'BestGuess' really produces the lowest RMSE. You could even do that in a loop, generating the different starting guesses randomly.
HTH
  2 Comments
Jeff Miller
Jeff Miller on 5 Jun 2018
No, sorry, I can't accept that responsibility. But you can post a lot more detailed explanation of the problems with your code, and maybe get more detailed suggestions for fixes. For starters, what do you mean that it doesn't run "properly"?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!