Fsolve with decision boundaries

Is there a way to use fsolve in MATLAB by specifying a score for the solution? those. all decision variables> 0

+3
source share
3 answers

Not directly, but one solution to this problem is to add a term to your equation that holds back your problem.

I don't have optimization tools, so I cannot give you a specific example using fsolve, but here is how I will do it with fminsearch, which has the same problem.

myFun = @(args) abs( sin(args(1)) + cos(args(2)) )
fminsearch(myFun, [0, 0])
ans =

   -0.8520    0.7188

But if I want to limit my problem to positive solutions

myFun = @(args) abs(sin(args(1)) + cos(args(2))) + (args(1)<0) + (args(2)<0)
fminsearch(myFun, [0, 0])
ans =

    0.0000    1.5708

There must be a way to tune your equation in a similar way to solve your problem.

+2
source

lsqnonlin, fsolve, .

- . , x >= 0, F (x) = 0 w.r.t. , F (z. ^ 2) = 0 w.r.t. z, x = z. ^ 2 . . , z (i) = 0 , .

+1

. F(x)=0 abs(F(x)), , , FMINBND.

, fminbnd, , (, , ). FMINCON .

0

Source: https://habr.com/ru/post/1761839/


All Articles