Dear Eduardo,

Maybe a stupid question, but why do you want to optimize numerically
a second order polinom?
What's the problem with the analytical solution?

Marci


--
             Márton Markó

    Wigner Research Centre for Physics
      Neutron Spectroscopy Department

address: Budapest, Konkoly Th. M. str 29-33, H-1121, Hungary
mail:    Budapest, P.O. Box 49 H-1525 HUNGARY
tel:     +36/1-392 2222/1682
fax:     +36/1-392 2501
email:   [email protected]


On Tue, 12 Aug 2014, ebmb.sci wrote:

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.




--
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
[email protected]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to