Fsolve : I want to give a condition which is something should be bigger than something, how can I do it?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am solving one objective function.
And one of the conditions is that something is bigger than something.
I can I write this condition in fsolve function?
pl=@(E) [
g/E(1)+G0(E)+rho*G1(E)*b/(1+a*b)-b/(1+a*b)*(g/E(2)+b*G1(E));
R-E(1)-E(2)
];
P=fsolve(pl, E0);
Here I want to give two more condition such as
pl=@(E) [
g/E(1)+G0(E)+rho*G1(E)*b/(1+a*b)>0
b/(1+a*b)*(g/E(2)+b*G1(E))>0
How can I do this?
0 commentaires
Réponses (2)
Walter Roberson
le 17 Avr 2012
In order to express that a > b, you can reframe that as a + c = b where c is constrained to be positive.
However, it may perhaps be difficult to express strictly positive, as a lot of the routines are set up for constraints >= 0 rather than > 0
0 commentaires
Sargondjani
le 17 Avr 2012
you could also use fmincon. have a look at it
then you have to make the objective pl^2, and you can supply the constraints separately
2 commentaires
Walter Roberson
le 17 Avr 2012
If pl(E).^2 is the objective, then pl(E) and -pl(E) become equally plausible, which does not help in requiring pl(E) > 0 .
Sargondjani
le 17 Avr 2012
i think there is some confusion...
his first 'pl' is the objective
his second 'pl' (should have gotten another name) are the constraints, which are the first and second part of the the objective function (both required >0).
when the latter 2 are inserted as constraints in fmincon, the algorithm will solve this properly...
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!