Resolution of equation under constraints with 'fminbnd'

hi, i must resolve the system of equations with two variable x and y, and i use 'solve' to do it, but i must limit the solution between an interval, can fminbnd function replace 'solve' in this case

3 Commenti

Torsten commented:
You have two equations in two unknowns ?
And the system of equations has multiple solutions ?
Best wishes
Torsten.
studentU
studentU il 23 Giu 2015
Modificato: studentU il 23 Giu 2015
thank's for ue repply, YES, i have tow equations with tow unknows, and my system can have multiple solutions.
The reason why I ask is that it is usually not possible to restrict the solution to a certain interval.
The best you can expect is to get values for x and y such that
f1(x,y)^2+f2(x,y)^2
is minimized if you want to solve
f1(x,y)=0 and f2(x,y)=0.
If this is what you want you can proceed as Matt suggested.
Best wishes
Torsten.

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 23 Giu 2015
No, fminbnd only handles problems in a single unknown. You can use lsqnonlin, if you have the Optimization Toolbox, or you can try things on the File Exchange, like fminsearchbnd

7 Commenti

thank's for ure repply, how can i produce, if i use lsqnonlin,for:
[a,b] = solve('G*cos(b)+F*sin(b)=1',' cos(b)*sin(el)-sin(b)*X2*cos(a)-sin(b)*X3*sin(a)=1', 'b', 'a')
when G,F,el,X2,X3 are numérical,
I look for a and b that verifies these equations, such that 0 <a <90 and -90 <b <90...
best regards.
Use as your objective function
f(x) = [G*cos(x(2))+F*sin(x(2))-1 ; cos(x(2))*sin(el)-sin(x(2))*X2*cos(x(1))-sin(x(2))*X3*sin(x(1))-1];
and set lb=[0;-90] and ub=[90,90]
lb=[0;-pi/2] and ub=[pi/2;pi/2]
Best wishes
Torsten.
thank's for ure replly,i m going to see it
i have tow arguments a and b!!! so, but i have try ure proposition as:
(can u use it with:
G = -0.4191;
F = -0.8674;
X2 =0.7610;
X3 = -0.4956;
x=lsqnonlin([G*cos(x(2))+F*sin(x(2))-1 ; cos(x(2))*sin(el)-sin(x(2))*X2*cos(x(1))-sin(x(2))*X3*sin(x(1))-1],-pi/2,[0;-pi/2], [pi/2;pi/2]);
>> x can't be defined for input arguments of type 'double'.
can u help me to resolve this problem,
best regards.
x = lsqnonlin(@(x) [G*cos(x(2))+F*sin(x(2))-1 ; cos(x(2))*sin(el)-sin(x(2))*X2*cos(x(1))-sin(x(2))*X3*sin(x(1))-1],-pi/2,[0;-pi/2], [pi/2;pi/2]);
it become already error: Failure in initial user-supplied objective function evaluation. LSQNONLIN cannot continue.
Your x0, your initial points, is -pi/2 which is a scalar. But your objective function expects a vector of length two (or more). You need to supply a vector of length 2 instead of -pi/2

Accedi per commentare.

Tag

Richiesto:

il 23 Giu 2015

Commentato:

il 26 Giu 2015

Community Treasure Hunt

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

Start Hunting!

Translated by