Undefined operator '+' for input arguments of type 'function_handle'.
显示 更早的评论
fun = @(Jw) kh_1./(Jw+kh_1); int=integral(fun,hrootzone,hgwt);
回答(1 个)
Star Strider
2017-11-2
I cannot reproduce that error with the code you posted (assuming ‘kh_1’, ‘hrootzone’, and ‘hgwt’ are double-precision values).
As a general rule, if you want to add (or do other operations on) functions, you have to evaluate them as functions.
Example —
f1 = @(x) x.^2;
f2 = @(x) 2*x;
f3 = @(x) f1(x) + f2(x); % Create New Anonymous Function To Sum Other Functions
x = 2;
y = f3(x);
类别
在 帮助中心 和 File Exchange 中查找有关 Just for fun 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!