Uses of function handles, MATLAB in Engineering

Uses of Function handles:

The Function handles can also be generated for functions other than anonymous functions, both built-in & user-defined functions. For illustration, the below would generate a function handle for the built-in factorial function:

>> facth = @factorial;

The @ operator acquiires the handle of the function, that is then stored in a variable facth.

The handle can be used to call the function, merely like the handle for the anonymous functions, for illustration:

>> facth(5)

ans =

120

By using the function handle to call the function rather than of using the name of the function does not itself elaborate why this is helpful, so a clear question would be why the function handles are essential.

 

Posted Date: 10/20/2012 6:47:27 AM | Location : United States







Related Discussions:- Uses of function handles, Assignment Help, Ask Question on Uses of function handles, Get Answer, Expert's Help, Uses of function handles Discussions

Write discussion on Uses of function handles
Your posts are moderated
Related Questions
Implementation of binary search: The binary search can be implemented as a recursive function. The recursive function below also implements this binary search algorithm. It re

Finding a sting - function strfind: The function strfind does necessarily similar thing, except that the order of the arguments does make dissimilarity. The common form is str

Related Structure Functions: There are many functions which can be used with structures in a MATLAB. The function isstruct will return 1 for logical true when the variable arg

Algorithm for subfunction: The algorithm for subfunction askforn is as shown:  Prompt the user for the positive integer n.  Loop to print an error message and reprom

Illustration of Graphics properties: A particular property can also be exhibited, for illustration, to view the line width:     >> get(hl,'LineWidth')     ans =

Example of Exponential function modular program: In order to view the distinction in the approximate value for e as n increases, the user kept choosing Limit & entering larger

Illustration of Passing arguments to functions: Here is an illustration of calling this function: >> printrand() The random # is 0.94 As nothing is passed to

Finding sums and products: A very general application of a for loop is to compute sums and products. For illustration, rather than of just printing the integers 1 through 5, w

Tracing of Square matrices: The trace of a square matrix is the addition of all the elements on the diagonal. For illustration, for the preceding matrix it is 1 + 6 + 11 + 16,

Gauss-Jordan: The Gauss-Jordan elimination technique begins in similar way which the Gauss elimination technique does, but then rather than of back-substitution, the eliminati