I want to write code for convex optimization given in the image below.I wrote some code.but did not work.Expecting help?
Mostrar comentarios más antiguos

here Cs ,Ci are nxn diagonal matrices.Ci Identity matrix
A is coefficient matrix order nxL
r variable vector to be optimized. order Lx1.
k is another optimization variable.
How to code. My version
function f=myobj(x,pxx,A)
z=[x(1) x(2) x(3) x(4)]
z(1)=x(5);
x(2)=0;
x(4)=0;
sum(z)=0.5*z(1)
a1=ones([1 length(pxx)]);
c1=diag(pxx);
c2=eye(length(pxx));
T=a1*c1*A*x;
Q=a1*c2*A*x;
f=T/Q;
end
fmincon(f,[0 0 0 0 0],[],[])
getting error.
Respuestas (1)
Alan Weiss
el 6 de Abr. de 2015
Without reading your problem in detail, it is clear that you are calling fmincon incorrectly. As clearly documented, fmincon expects your objective function to contain a single multidimensional variable as the argument, not three variables as you have. If pxx and A are extra parameters, then pass them using the correct syntax,
f = @(x)myobj(x,pxx,A)
Alan Weiss
MATLAB mathematical toolbox documentation
Categorías
Más información sobre Get Started with Optimization Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!