Optimization of one output of a vectorfunction using fminunc

5 views (last 30 days)
Hi!
Last time I got a very helpful idea. Now I defined a vectorfunction which has several variables x1,x2,x3,u1,u2 and also several outputs y1,y2,y3,...,yN. Now I would like to optimize only one output, i.e. I optimize f.ex. only y3. In my case y3 is a function that I get from y1,y2... .
I tried to find the answer, but mostly fminunc were used to optimize y or y1,y2,y3,..... What is the command in the fminunc solver to optimize only one output?
Thanks

Accepted Answer

Sean de Wolski
Sean de Wolski on 3 Feb 2015
Inside of your objective function, only return that output:
function y3 = myobjfun(x)
% do whatever
y3 = something;
end
  5 Comments
Michael Haderlein
Michael Haderlein on 4 Feb 2015
Your efficiency function obviously returns an array. It must be a scalar though. Maybe you actually want to optimize w.r.t. norm(efficiency)?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!