A function handle is a pointer to another function and is defined with the syntax
@function-name
For example
f = @sin;
Creates a function handle called f
that refers to the
function sin
.
Function handles are used to call other functions indirectly, or to pass
a function as an argument to another function like quad
or
fsolve
. For example
f = @sin; quad (f, 0, pi) => 2
You may use feval
to call a function using function handle, or
simply write the name of the function handle followed by an argument
list. If there are no arguments, you must use an empty argument list
(). For example
f = @sin; feval (f, pi/4) => 0.70711 f (pi/4) => 0.70711
Return a struct containing information about the function handle fcn_handle.