필터 지우기
필터 지우기

MATLAB R2015a multivariable function optimization

조회 수: 1 (최근 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 CenterFile Exchange에서 Get 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