How to use "@" functionhandle for multiple inputs? (to use with fmincon)
Afficher commentaires plus anciens
Hallo,
I wrote a function (which works by itself), which can be called like this:
[output]=get_amps(input,par)
"output" can not be written as simple analytical function of "input".
Now I want to optimize the parameters "par" using fmincon:
input_a=a; % a is a vector in the workspace
par0=[100,5000];
out_a = @opt_a get_amps(input_a,par0); % here is the problem
objective = @opt_a sum((input_a-out_a).^2);
p_opt=fmincon(objective,par0);
In line3 I get the error:
" Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. ..."
How to use the @function handle with functions with multiple inputs?
Is there a better way to optimze parameters of a (non-analytical) function than fmincon?
I would be greatfull for any help.
best
Ralf
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Nonlinear Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!