[op4,rpt4] = findop(mdl,opspec,opt);
op4.States
(1.) scdTanks/Inertia
x: 0
(2.) scdTanks/Tank1
x: 15
(3.) scdTanks/Tank2
x: 15
(4.) scdTanks/Tank3
x: 16
The optimization result is the same as the result for the nongradient solution.
To see if the gradients improve the optimization efficiency, view the operating point
search reports. For example, compare the number function evaluations for the solution:
- Without gradients:
rpt3.OptimizationOutput.funcCount
ans =
25
- With gradients:
rpt4.OptimizationOutput.funcCount
ans =
5
For this example, adding the analytical gradients decreases the number of function calls
during optimization.
See Also
findop | getInputIndex | getOutputIndex | getStateIndex | operspec
See Also