MATLAB: How to pass anonymus function handle to functions

anonymusfunctionhandleinput

As I see in the documentation, this is the method: fun = @(x)x./(exp(x)-1); q4 = integral(fun,0,Inf); However this is very strange for me. Why not: q4 = integral(@fun,0,Inf); ?
For example sqrt = @(x) x.^.5 is the same function as the built in sqrt, but we can use the builtin sqrt as integral(@sqrt,0,1); and the defined one as integral(sqrt,0,1); ? This is inconsistent!

Best Answer

The @ operator creates a function handle. An anonymous function is already a function handle. Consider:
integral(@sin, 0, pi/2) % @ creates a temporary function handle to the sin function
f = @sin;
integral(f, 0, pi/2) % The same as the above, just split across two lines using an intermediate variable
integral(@(x) sin(x), 0, pi/2) % The same as the above, just using an anonymous function