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
Examine exponential function: The algorithm for the main script program is shown below:  Call a function eoption to show the menu and return the user's choice.  Loop

Algorithm for appex subfunction: The algorithm for appex subfunction is as shown:  Receives x & n as the input arguments.  Initializes a variable for running sum of t

Function cirarea - Anonymous functions: The function handle name is cirarea. The one argument is passed to the input argument radius. The body of the function is an expression

Use of While loop: Here is an illustration of calling the function, passing 5000 for the value of the input argument high. >> factgthigh(5000) ans = 5040 The itera

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

Set Operations: The MATLAB has numerous built-in functions which perform set operations on vectors. These involve intersect, union, setdiff, unique, and setxor. All these func

IS Functions in Matlab: There are many functions which are built into MATLAB which test whether or not something is true; these function names start with the word is. As these

Splits a string : The strtok function splits a string into pieces; it can be called in many ways. The function receives one string as an input argument. It appears for the fir

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

Example to change the line width from the default: For illustration, to change the line width from the default of 0.5 to 1.5: >> set(hl,'LineWidth',1.5) As long as the