error in minimize function

Hi I want to calculate minimum of this function but when I using nonlinear constrain, i have this error
x=fmincon(fx,[1,1],[],[],[],[],[1 0.99],[1 1.1],@confun)
No feasible solution found.
fmincon stopped because the size of the current step is less than the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
1.000000000000000 1.099999986802130

5 comentarios

Walter Roberson
Walter Roberson el 17 de Jun. de 2015
We are going to need to see your confun. fx might help as well.
You realize that you set the lower bound and upper bound to the first element to both be 1, so the first element will always be exactly 1?
Mohammad
Mohammad el 17 de Jun. de 2015
Editada: Mohammad el 17 de Jun. de 2015
yes I want the first element be 1. my function is :
f=@(G,r)abs((G*r)/4 + ((G^2*r^2)/16 + (G*r)/4 - 1/4)^(1/2) + 1/2) + abs((2004*G + 200*G*r + 1001*G^2*r + 200)/(6006*G + 600) - ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))/(((G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^2 + ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))^3)^(1/2) + G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^(1/3) + (((G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^2 + ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))^3)^(1/2) + G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^(1/3));
>> fx=@(x)f(x(1),x(2));
Also my Confun, which saves as mfile is:
function [c, ceq] = confun(x)
% Nonlinear inequality constraints
c = [(x(1)*x(2))-1];
% Nonlinear equality constraints
ceq = [];
this constrain says that G<(1/r) but when I say the answer which give me matlab, these constrain have been ignored.
Matt J
Matt J el 17 de Jun. de 2015
Since you already know that x(1)=1, what happens when you run as follows:
fx=@(z)f(1,z);
nonlcon=@(z) confun([1,z])
x=fmincon(fx,1,[],[],[],[], 0.99,1.1,nonlcon);
Mohammad
Mohammad el 17 de Jun. de 2015
for simplification the problem i said this actually G and r is not constant
Matt J
Matt J el 17 de Jun. de 2015
But what happens when you do it?

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Preguntada:

el 16 de Jun. de 2015

Comentada:

el 17 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by