problem using fminsearch, as parameters that I want to optimize is not input for the handle function
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
What if my model is composited by many subfunctions, and the handle function I am going to use in fminsearch doesn't include the parameters I want to optimize?
For example:
handle function is RMSD(prediction, experiment)
but the parameters I want to optimize is lambda1 and lambda2 which is in the mainfunction where RMSD is called?
How should I write the fminsearch then?
so far i write
[optimal,rmsdmin,exitflag,optimaloutput]=fminsearch(RMSD,@mainfunction,optimal0);
doesn't work
0 Kommentare
Antworten (2)
Yogananda Jeppu
am 11 Nov. 2017
I am not sure how to do this. I have been using global in my function and optimizing using fminsearch (fmins before). It always works for me - though not a very elegant solution. My take has been I want the optimized solution not the code!
0 Kommentare
Alan Weiss
am 13 Nov. 2017
This is a question of thinking deliberately. If I understand you correctly, you want to find the control variable lambda = (lambda(1),lambda(2)) that gives the lowest value of RMSD. But RMSD does not depend explicitly on lambda.
Here is where deliberate thinking comes in. fminsearch wants a function that accepts lambda and gives the value of RMSD. If you think about it, you should realize that is exactly what you want, too: the value of RMSD for a given value of lambda. Either you can compute these values or you cannot. If you can compute them, then think about how you do it, and write a MATLAB function that takes a value lambda and returns the RMSD value (this function may well call RMSD).
Alan Weiss
MATLAB mathematical toolbox documentation
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surrogate Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!