use of fminunc with more than one variables
2 views (last 30 days)
Show older comments
I am working to solve an uncostraint non-linear optimization using 'fminunc'
there are two versions
1.using a vector for different variables
>> fminunc(@(x)(x(1)-x(2)^0.4)/x(1), [1,2])
Solver stopped prematurely.
fminunc stopped because it exceeded the function evaluation limit,
options.MaxFunctionEvaluations = 200 (the default value).
ans =
1 2
2. using different variables
>> fminunc(@(x1,x2)(x1-x2^0.4)/x1, 1,2, 'options')
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in createOptionFeedback (line 33)
options.(stopTestOptions{k}) = [];
Error in prepareOptionsForSolver (line 57)
optionFeedback = createOptionFeedback(options);
Error in fminunc (line 156)
[options, optionFeedback] = prepareOptionsForSolver(options, 'fminunc');
As you can observe, the 1st version works, whereas 2nd fails.
What is the reason for this error, Is there way to make work the 2nd version ?
Thanks,
best regards,
Rahul
0 Comments
Answers (1)
Alan Weiss
on 5 Apr 2019
If you have Release 2019a, you can also use the problem-based workflow, which would allow you to use two different control variables.
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
See Also
Categories
Find more on Nonlinear 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!