Borrar filtros
Borrar filtros

MATLAB R2015a multivariable function optimization

1 visualización (últimos 30 días)
Bogdan
Bogdan el 1 de Mayo de 2016
Comentada: Bogdan el 1 de Mayo de 2016
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Mayo de 2016
Editada: Walter Roberson el 1 de Mayo de 2016
fob_2v = @(kt) fob_2(kt(1), kt(2))
y=fminsearch(fob_2v,[1,1])
  3 comentarios
Walter Roberson
Walter Roberson el 1 de Mayo de 2016
Lots of experience ;-) This kind of solution gets used a lot.
Bogdan
Bogdan el 1 de Mayo de 2016
I understand. Thank you, one more time :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by