[Scilab-users] Optimization question
Stéphane Mottelet
stephane.mottelet at utc.fr
Wed Aug 13 09:14:41 CEST 2014
Le 13/08/2014 03:11, ebmb.sci a écrit :
> Hello All,
> please, could someone guide me on how to proceed to minimize the following
> polynomial using functions optim and numdiff. Since the parameters A and B
> have different constraints (i.e.: A = [0 1] and B = [1000 2000]), how must I
> sign the values and pass them for optim? I implemented a basic script to try
> to do it, but it always returns with wrong results.
>
> function f = myFc(x)
> a = x(1);
> b = x(2);
> f = 0.000791 + 0.000027*a + -0.000037*b + 0.000180*a*b + -0.000126*a^2 +
> -0.000162*b^2;
> endfunction
>
> function [f, g, ind] = myFcCost(x, ind)
> f = myFc(x);
> g = numdiff(myFc, x);
> endfunction
>
> x0 = [0 1];
>
> [fopt, xopt] = optim(myFcCost, 'b', [0 1], [1000 2000], x0);
>
> I am so thanks for any help in advance!
>
> Best regards,
> Eduardo.
Hello,
your bounds should be given this way (first vector for lower bounds and
second for upper ones) :
[fopt, xopt] = optim(myFcCost, 'b', [0 1000], [1 2000], x0);
S.
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Optimization-question-tp4031028.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list