error using fminbnd with multiple objective function

I have a function "f1" which has multiple inputs and 4 outputs.
[Opt,L,Cost,N_Afa]=f1(R_p,r_B,N_Af,X_A,P_f,T,mu,M_A,M_B,M_C,k,D_A,R,c_1,c_2,rho_p)
I want to use fminbnd to minimise the Objective "Opt" by changing the variables "R_p" and "r_B" while treating all other inputs as constants. I made an additional function "out" that turns the multiobjective function into a single output function so that fminbnd can handle it based on the response to someone elses question:
function result= out(f1,R_p,r_B,varargin)
n = nargout(f1);
outs = cell(1,n);
[outs{:}] = f1(R_p,r_B,(varargin{:}));
result = outs{end};
end
[alpha,fval]=fminbnd(@(R_p,r_B)out(@f1,R_p,r_B,N_Af,X_A,P_f,T,mu,M_A,M_B,M_C,k,D_A,R,c_1,c_2,rho_p), 0,1);
However, I get an error of not enough input arguments when i run:
result= out(f1,R_p,r_B,varargin)

回答 (1 件)

Matt J
Matt J 2019 年 7 月 6 日
編集済み: Matt J 2019 年 7 月 6 日

1 投票

A few problems
  1. fminbnd cannot minimize functions of more than one unknown variable
  2. All Matlab minimization routines e.g. fminsearch expect the unknows to be passed in vector form to your objective function, not as separate arguments.

カテゴリ

ヘルプ センター および File ExchangeView and Analyze Simulation Results についてさらに検索

質問済み:

2019 年 7 月 6 日

編集済み:

2019 年 7 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by