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

Graphics Properties: The MATLAB uses the Handle Graphics in all its figures. All figures consist of various objects, each of which is assigned a handle. The object handle is a

Illustration of Set operations: For illustration, given the vectors as shown below: >> v1 = 2:6 v1 = 2  3  4  5  6 >> v2 = 1:2:7 v2 = 1  3  5  7

Scaling:   change a row by multiplying it by a non-zero scalar sri →  ri For illustration, for the matrix:


Illustration of gauss-jordan elimination: An illustration of interchanging rows would be r1 ¬→ r3, that would results: Now, beginning with this matrix, an illustration of sc

Replacing a string - function strrep: The function strrep finds all the occurrences of a substring within the string, and substitutes them with a new substring. The order of a

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

Sort algorithm for Sorting vectors of structures: Note that only the price field is compared in the sort algorithm, but the whole structure is replaced. That is therefore each

Plotting from a Function: The following function creates a Figure Window as shown in figure, which shows various types of plots for similar y vector. The vector is passed as a