フィルターのクリア

How can i optimize a symbolic function?

5 ビュー (過去 30 日間)
Natanael Acencio Rijo
Natanael Acencio Rijo 2013 年 12 月 6 日
回答済み: Andrei Bobrov 2013 年 12 月 6 日
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.

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2013 年 12 月 6 日
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)});

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by