ANONYMOUS ANONYMOUS Anonymous Functions

Usage

Anonymous functions are simple, nameless functions that can be defined
anywhere (in a script, function, or at the prompt).  They are intended
to supplant inline functions.  The syntax for an anonymous function
is simple:

   y = @(arg1,arg2,...,argn) expression

where arg1,arg2,...,argn is a list of valid identifiers that define
the arguments to the function, and expression is the expression to
compute in the function.  The returned value y is a function handle
for the anonymous function that can then be used to evaluate the expression.
Note that y will capture the value of variables that are not indicated
in the argument list from the current scope or workspace at the time
it is defined.  So, for example, consider the simple anonymous function
definition

   y = @(x) a*(x+b)

In order for this definition to work, the variables a and b need to
be defined in the current workspace.  Whatever value they have is captured
in the function handle y.  To change the values of a and b in the
anonymous function, you must recreate the handle using another call.  See
the examples section for more information.  In order to use the anonymous
function, you can use it just like any other function handle.  For example,

   p = y(3)
   p = y()
   p = feval(y,3)

are all examples of using the y anonymous function to perform a calculation.
