Borrar filtros
Borrar filtros

How can i optimize a symbolic function?

5 visualizaciones (últimos 30 días)
Natanael Acencio Rijo
Natanael Acencio Rijo el 6 de Dic. de 2013
Respondida: Andrei Bobrov el 6 de Dic. de 2013
I got a function which gives this final result:
5.3*p(1) + 5.5*p(2) + 5.8*p(3) + 0.004*p(1)^2 + 0.006*p(2)^2 + 0.009*p(3)^2 + 1100.0
I want to find the minimum of this function using GA in the optimization toolbox. The problem here is that the function is in sym class, and when i try to convert to double the variables are not converted.
Note: i must not assign values to p before optimizing,this is to be done by the optimization algorithm.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 6 de Dic. de 2013
Please try this is code:
z = ...
subs(5.3*p(1) + 5.5*p(2) + 5.8*p(3) +...
0.004*p(1)^2 + 0.006*p(2)^2 + 0.009*p(3)^2 + 1100.0,p,sym('p_',[numel(p),1]));
fun = matlabFunction(z,'vars',{symvar(z)});

Categorías

Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by