Undefined operator '+' for input arguments of type 'function_handle'.
Show older comments
fun = @(Jw) kh_1./(Jw+kh_1); int=integral(fun,hrootzone,hgwt);
Answers (1)
Star Strider
on 2 Nov 2017
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);
Categories
Find more on Just for fun 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!