未定义与 'function_handle' 类型的输入参数相对应的运算符 '*'。
Show older comments
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' 类型的输入参数相对应的运算符 '*'。
Accepted Answer
More Answers (0)
Categories
Find more on Energy Production in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!