Optimizing a Black Box function
11 views (last 30 days)
Show older comments
I have a black box function to be optimized. The input is a scalar and the output to be optimized is also a scalar.In this case, is there any hints on which function or method can I implement? Thanks!
A more specific description: I am trimming a simulink model. Basically it is an aircraft dynamic model to be trimmed. I am trimming the aircraft with the flap, elevator and throttle( input variables ). My strategy is that for any trim point, firstly fix the elevator deflection and throttle, search for the flap deflection which renders minimum drag ( objective function ). Then fix the flap as the searched value, and then search for elevator which trim the whole model.
The code I used for trimming is 'findop' in matlab, which for me is a total black box, and my problem arises when I tried to search for flap deflection which gives minimum drag. The objective function is a scalar (drag coefficient) and the input to be searched is also a scalar (the other two input variables are fixed already). In this case, is it possible to use 'fminbnd'? If possible, any hints on how to implement it in detail? Thanks!!!
0 Comments
Answers (1)
Alan Weiss
on 28 May 2015
You have three variables: flap, elevator, and throttle. I would try to minimize drag by controlling all three variables at once, not using separate 1-dimensional minimizations. My x variable would have x(1) = flap, x(2) = elevator, and x(3) = throttle. You almost certainly have bounds on these variables. So, depending on your available toolboxes, I would either use fmincon from Optimization Toolbox, or patternsearch from Global Optimization Toolbox, because these solvers allow you to impose bounds.
If you use fmincon, I suggest that you read about optimizing a simulation or ODE, in particular, about setting larger-than-default finite differences.
You will have to figure out for yourself how to connect your Simulink model to an optimizer, I am not familiar enough with Simulink to give you a good answer.
Alan Weiss
MATLAB mathematical toolbox documentation
1 Comment
Titus Edelhofer
on 28 May 2015
You might use the function "sim" for simulating your Simulink model. Take a look at the parameter "SrcWorkspace": it allows you to specify the current workspace for the variables. This way you don't have to assign variables to the base workspace...
If you happen to have Simulink Design Optimization, it helps you with those tasks ...
Titus
See Also
Categories
Find more on Manual Performance Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!