Is there anyway I can use arrayfun and GlobalSearch at the same time?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I am trying to use GlobalSearch but not sure how to implement it.
Sol = arrayfun( @(v,w,x) fminsearchbnd(@(cv) -valfunc1(c2,v,w,x,cv(1),cv(2),param,glob), [10;10], [glob.kmin;glob.dmin], [60;60]), s(:,1), s(:,2), s(:,3), 'UniformOutput', false);
I used to get code as above. So Sol(1) give me the minimizer 'cv' given s(1,1) s(1,2) s(1,3). Sol(2) gives me the minimizer given s(2,1) s(2,2) s(2,3)....
So if s(:,1) is 10*1 column (same as s(:,2),s(:,3)), then the Sol should give me 10*2 matrix of solutions.
I would like to use GlobalSearch instead of fminsearch.
I found out that the code for GlobalSearch should look like as follows
gs = GlobalSearch;
obj = @(cv)-valfunc1(c2,v,w,x,cv(1),cv(2),param,glob);
problem = createOptimProblem('fmincon','x0',[0 0],...
'objective',obj,'lb',[-20 2],'ub',[60 60]);
x = run(gs,problem);
I also want to use arrayfun to get the solution as a vector(10*2).
However, I am not sure how to use arryfun in this case.
So I was wondering if it is possible to use GlobalSearch and still use arrayfun at the same time.
Thanks in advance.
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Global or Multiple Starting Point Search in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!