How do I use GlobalSearch to find global minimum?
Show older comments
Hi
I'm trying to find a global minimum when fitting my function to my dataset
% ramaniw = @(p,freq) ramani_4s(p,freq,constants(1,:),M0_wm,theta,linesh);
ramanig = @(p,freq) ramani_4s(p,freq,constants(2,:),M0_gm,theta,linesh);
opts = optimset;%('Algorithm','trust-region-reflective');
problemw = createOptimProblem('lsqcurvefit','objective',ramaniw,'x0',ptsw,'xdata',freq,...
'ydata',ydata_wm,'lb',lb,'ub',ub,'options',options);
problemg = createOptimProblem('lsqcurvefit','objective',ramanig,'x0',ptsg,'xdata',freq,...
'ydata',ydata_gm,'lb',lb,'ub',ub,'options',options);
gs = GlobalSearch;
[xw,fw,exitflagw,outputw] = run(gs,problemw);
but I get the following error:
Error using AbstractGlobalSolver/checkProblem (line 227) Invalid problem structure: missing required field or invalid field value.
Error in GlobalSearch/run (line 305) obj.checkProblem(problem, probRequiredFields, probValidValues);
Error in main_mt_s (line 108) [xw,fw,exitflagw,outputw] = run(gs,problemw);
Does any of you know what I do wrong? Thank you for your help!
Best regards Nanna
Answers (2)
Alan Weiss
on 15 Apr 2013
It seems to me that you wrote
opts = optimset(...)
but then you passed options, not opts:
problemg = createOptimProblem(...,'options',options);
Should be
problemg = createOptimProblem(...,'options',opts);
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
Nanna
on 15 Apr 2013
Alan Weiss
on 15 Apr 2013
Edited: Alan Weiss
on 15 Apr 2013
Perhaps you can show us your problem structure so that we can see why GlobalSearch throws this error. I mean, enter "problemw" at the command line, and copy-paste the result to this newsgroup, formatted properly with the {}Code tool.
Alan Weiss
MATLAB mathematical toolbox documentation
Nanna
on 23 Apr 2013
Alan Weiss
on 23 Apr 2013
0 votes
I am puzzled. Did you try running lsqcurvefit on the problem structure? If so, what happened? If not, please try it, as suggested in the documentation (step 10).
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!