MATLAB R2015a multivariable function optimization

3 ビュー (過去 30 日間)
Bogdan
Bogdan 2016 年 5 月 1 日
コメント済み: Bogdan 2016 年 5 月 1 日
I am trying to minimize an objective function with two variables, using MATLAB R2015a. The objective function is:
function i3 = fob_2(kp,ti)
G_P = tf(0.2,[2 4 1]);
G_TT = tf(0.1,[0.5 1]);
G_TC = tf(kp*[1 1/ti],[1 0]);
G_CV = 50;
G_TA = 0.1;
G_direct = G_TC * G_CV * G_P;
G_loop = feedback (G_direct , G_TT);
G_SYS = G_TA * G_loop;
SP = 1;
[DT,time] = step(SP * G_SYS);
error = SP - DT;
i3 = trapz(time,error.^2);
I tried a few optimization functions, but none of them seem to work. I always get the error message: "**Not enough input arguments.**" at the fifth line of the function, which is
G_TC = tf(kp*[1 1/ti],[1 0]);
I tried the following functions, presented by the used syntax (at this point I don't care much about the starting point. I care more about getting an answer and correctly programming the optimization function):
y=fminimax(fob_2,[1,1])
y=fminsearch(fob_2,[1,1])
y=fminunc(fob_2,[1,1])
I am sure that the function is correctly programmed, because when I try to call it with two parameters, something like:
fob_2(2,5)
MATLAB returns the computed value.
So, the problem is on my end, but I don't see where am I mistaking. Can you help me?
Thank you in advance.

採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 1 日
編集済み: Walter Roberson 2016 年 5 月 1 日
fob_2v = @(kt) fob_2(kt(1), kt(2))
y=fminsearch(fob_2v,[1,1])
  3 件のコメント
Walter Roberson
Walter Roberson 2016 年 5 月 1 日
Lots of experience ;-) This kind of solution gets used a lot.
Bogdan
Bogdan 2016 年 5 月 1 日
I understand. Thank you, one more time :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by