brute force procedure for a function

2 Ansichten (letzte 30 Tage)
Alexey
Alexey am 6 Aug. 2014
Beantwortet: Yu Jiang am 6 Aug. 2014
Dear collegues,
I have a question about design of flexiable brute force procedure over functions parameters. suppose I have a function
kpi = func(a,b,c)
in brute force function i want to select only for which parameters optimize and in which range e.g.: Optimization over a = 1:5 and c= 100:125 and b = 2
result = f_opt(@func,[1 0 1], {1:5,2,100:125})
the number of parameters in func must be canchagable. func is not vectorized.
What is the best way to design such function?

Antworten (1)

Yu Jiang
Yu Jiang am 6 Aug. 2014
If you would like to fix one parameter, e.g., b and optimize the function by finding appropriate a and c in their given range, you may try the following
x = fmincon(@(x) func(x(1),b,x(2)), x0, [], [], [], [], [1 100], [5 125])
where x0 is the initial condition.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by