"sai" wrote in message <k69p5k$4f9$1@newscl01ah.mathworks.com>...
> Hi,
>
> I am trying to minimize a function using the following:
>
> [A, fval] = fmincon(myfun, 1, s(:), x(:), [], [], 0, min(x./s_real);
>
> myfun = @(A) sum(s./(x-A*s)) - C;
>
> Both s and x are vectors where as A and C are scalars.
>
> The solution for 'A' turns out to be the upper bound, since 'myfun' is a monotonic function but this results in fval = Inf. I want to avoid this.
>
> How can I change the inequality constraint (A*s-x) <= 0 to (A*s-x) < 0 so that 'fval' doesn't become Inf? I tried lowering the upper bound to 'min(x./s_real)-eps' but that makes A = 0.
>
> Ideally, myfun = 0, for some A. Are there any other options in matlab?
>
> Any help is appreciated.
>
> Thanks
If both x >= 0 and s >= 0, then A=0 is the correct solution for your above
problem.
If this solution does not fit your needs, you will have to specify a different
function to be minimized.
Best wishes
Torsten.
> Hi,
>
> I am trying to minimize a function using the following:
>
> [A, fval] = fmincon(myfun, 1, s(:), x(:), [], [], 0, min(x./s_real);
>
> myfun = @(A) sum(s./(x-A*s)) - C;
>
> Both s and x are vectors where as A and C are scalars.
>
> The solution for 'A' turns out to be the upper bound, since 'myfun' is a monotonic function but this results in fval = Inf. I want to avoid this.
>
> How can I change the inequality constraint (A*s-x) <= 0 to (A*s-x) < 0 so that 'fval' doesn't become Inf? I tried lowering the upper bound to 'min(x./s_real)-eps' but that makes A = 0.
>
> Ideally, myfun = 0, for some A. Are there any other options in matlab?
>
> Any help is appreciated.
>
> Thanks
If both x >= 0 and s >= 0, then A=0 is the correct solution for your above
problem.
If this solution does not fit your needs, you will have to specify a different
function to be minimized.
Best wishes
Torsten.