未定义与 'function_handle' 类型的输入参数相对应的运算符 '*'。
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
a=0.04;b=0.05;c=30;d=20;g=100;
f1=g*(@(x)exp(-b*x(2))/b+@(x)exp(-a*x(1))/a+((x(1)+x(2))-(b*x(2)+a*x(1)+1)/(a+b)-(a*b*(x(1)+x(2))-x(2)*a^2-x(1)*b^2)/((a+b)^2))*@(x)exp(-(b*x(2)+a*x(1))));
f2=c*(x(1)+(@(x)exp(-a*x(1))-1)/a+@(x)exp(-b*x(2))/b-(@(x)exp(-a*x(1))*@(x)exp(-b*x(2)))/(a+b));
f3=d*(x(2)+(@(x)exp(-b*x(2))-1)/b+@(x)exp(-a*x(1))/a-(@(x)exp(-a*x(1))*@(x)exp(-b*x(2)))/(a+b));
fun=f1+f2+f3;
lb=0;ub=80;
[x,fval]=ga(fun,2,[],[],[],[],lb,ub)
求大神帮忙看看,我想用ga工具箱求一个二元函数的最小值,运行完之后提示f1错误,原因是:未定义与 'function_handle' 类型的输入参数相对应的运算符 '*'。
0 commentaires
Réponse acceptée
fbpwacx
le 22 Mai 2023
仅供参考
a=0.04;b=0.05;c=30;d=20;g=100;
fun=@(x)g*(exp(-b*x(2))/b+exp(-a*x(1))/a+((x(1)+x(2))-(b*x(2)+a*x(1)+1)/(a+b)-(a*b*(x(1)+x(2))-x(2)*a^2-x(1)*b^2)/((a+b)^2))*exp(-(b*x(2)+a*x(1))))...
+c*(x(1)+(exp(-a*x(1))-1)/a+exp(-b*x(2))/b-(exp(-a*x(1))*exp(-b*x(2)))/(a+b))...
+d*(x(2)+(exp(-b*x(2))-1)/b+exp(-a*x(1))/a-(exp(-a*x(1))*exp(-b*x(2)))/(a+b));
lb=0;ub=80;
[x,fval]=ga(fun,2,[],[],[],[],lb,ub)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Energy Production dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!